You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*When configured, the button will display the icon instead of text.*
20
21
|buttonType |`+'primary'+`, or `+'secondary'+` |optional |default: `+'secondary'+` - Whether to style the button as a primary, or secondary button.
21
22
|enabled |boolean |optional |default: `+true+` - When `+false+`, the button will be disabled when the dialog loads.
22
23
|align |`+'end'+` or `+'start'+` |optional |default: `+'end'+` - When set to `+'end'+` the button will display on the right-hand side of the dialog. When set to `+'start'+` the button will display on the left-hand side.
Copy file name to clipboardExpand all lines: modules/ROOT/partials/configuration/ai_shortcuts.adoc
+42-25Lines changed: 42 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,25 +19,25 @@ When configured with an instance-specific object array, the {pluginname} shortcu
19
19
[source, js]
20
20
----
21
21
[
22
-
{ title: 'Summarize content', prompt: 'Provide the key points and concepts in this content in a succinct summary.' },
23
-
{ title: 'Improve writing', prompt: 'Rewrite this content with no spelling mistakes, proper grammar, and with more descriptive language, using best writing practices without losing the original meaning.' },
24
-
{ title: 'Simplify language', prompt: 'Rewrite this content with simplified language and reduce the complexity of the writing, so that the content is easier to understand.' },
25
-
{ title: 'Expand upon', prompt: 'Expand upon this content with descriptive language and more detailed explanations, to make the writing easier to understand and increase the length of the content.' },
26
-
{ title: 'Trim content', prompt: 'Remove any repetitive, redundant, or non-essential writing in this content without changing the meaning or losing any key information.' },
22
+
{ title: 'Summarize content', prompt: 'Provide the key points and concepts in this content in a succinct summary.', selection: true },
23
+
{ title: 'Improve writing', prompt: 'Rewrite this content with no spelling mistakes, proper grammar, and with more descriptive language, using best writing practices without losing the original meaning.', selection: true },
24
+
{ title: 'Simplify language', prompt: 'Rewrite this content with simplified language and reduce the complexity of the writing, so that the content is easier to understand.', selection: true },
25
+
{ title: 'Expand upon', prompt: 'Expand upon this content with descriptive language and more detailed explanations, to make the writing easier to understand and increase the length of the content.', selection: true },
26
+
{ title: 'Trim content', prompt: 'Remove any repetitive, redundant, or non-essential writing in this content without changing the meaning or losing any key information.', selection: true },
27
27
{ title: 'Change tone', subprompts: [
28
-
{ title: 'Professional', prompt: 'Rewrite this content using polished, formal, and respectful language to convey professional expertise and competence.' },
29
-
{ title: 'Casual', prompt: 'Rewrite this content with casual, informal language to convey a casual conversation with a real person.' },
30
-
{ title: 'Direct', prompt: 'Rewrite this content with direct language using only the essential information.' },
31
-
{ title: 'Confident', prompt: 'Rewrite this content using compelling, optimistic language to convey confidence in the writing.' },
32
-
{ title: 'Friendly', prompt: 'Rewrite this content using friendly, comforting language, to convey understanding and empathy.' },
28
+
{ title: 'Professional', prompt: 'Rewrite this content using polished, formal, and respectful language to convey professional expertise and competence.', selection: true },
29
+
{ title: 'Casual', prompt: 'Rewrite this content with casual, informal language to convey a casual conversation with a real person.', selection: true },
30
+
{ title: 'Direct', prompt: 'Rewrite this content with direct language using only the essential information.', selection: true },
31
+
{ title: 'Confident', prompt: 'Rewrite this content using compelling, optimistic language to convey confidence in the writing.', selection: true },
32
+
{ title: 'Friendly', prompt: 'Rewrite this content using friendly, comforting language, to convey understanding and empathy.', selection: true },
33
33
] },
34
34
{ title: 'Change style', subprompts: [
35
-
{ title: 'Business', prompt: 'Rewrite this content as a business professional with formal language.' },
36
-
{ title: 'Legal', prompt: 'Rewrite this content as a legal professional using valid legal terminology.' },
37
-
{ title: 'Journalism', prompt: 'Rewrite this content as a journalist using engaging language to convey the importance of the information.' },
38
-
{ title: 'Medical', prompt: 'Rewrite this content as a medical professional using valid medical terminology.' },
39
-
{ title: 'Poetic', prompt: 'Rewrite this content as a poem using poetic techniques without losing the original meaning.' },
40
-
] },
35
+
{ title: 'Business', prompt: 'Rewrite this content as a business professional with formal language.', selection: true },
36
+
{ title: 'Legal', prompt: 'Rewrite this content as a legal professional using valid legal terminology.', selection: true },
37
+
{ title: 'Journalism', prompt: 'Rewrite this content as a journalist using engaging language to convey the importance of the information.', selection: true },
38
+
{ title: 'Medical', prompt: 'Rewrite this content as a medical professional using valid medical terminology.', selection: true },
39
+
{ title: 'Poetic', prompt: 'Rewrite this content as a poem using poetic techniques without losing the original meaning.', selection: true },
40
+
] }
41
41
]
42
42
----
43
43
@@ -59,18 +59,18 @@ tinymce.init({
59
59
toolbar: 'aidialog aishortcuts',
60
60
ai_request: (request, respondWith) => respondWith.string(() => Promise.reject("See docs to implement AI Assistant")),
61
61
ai_shortcuts: [
62
-
{ title: 'Screenplay', prompt: 'Convert this to screenplay format.' },
63
-
{ title: 'Stage play', prompt: 'Convert this to stage play format.' },
62
+
{ title: 'Screenplay', prompt: 'Convert this to screenplay format.', selection: true },
63
+
{ title: 'Stage play', prompt: 'Convert this to stage play format.', selection: true },
64
64
{ title: 'Classical', subprompts:
65
65
[
66
-
{ title: 'Dialogue', prompt: 'Convert this to a Socratic dialogue.' },
67
-
{ title: 'Homeric', prompt: 'Convert this to a Classical Epic.' }
66
+
{ title: 'Dialogue', prompt: 'Convert this to a Socratic dialogue.', selection: true },
67
+
{ title: 'Homeric', prompt: 'Convert this to a Classical Epic.', selection: true }
68
68
]
69
69
},
70
70
{ title: 'Celtic', subprompts:
71
71
[
72
-
{ title: 'Bardic', prompt: 'Convert this to Bardic verse.' },
73
-
{ title: 'Filí', prompt: 'Convert this to Filí-an verse.' }
72
+
{ title: 'Bardic', prompt: 'Convert this to Bardic verse.', selection: true },
73
+
{ title: 'Filí', prompt: 'Convert this to Filí-an verse.', selection: true }
74
74
]
75
75
},
76
76
]
@@ -99,14 +99,31 @@ tinymce.init({
99
99
100
100
=== Valid Shortcuts
101
101
102
-
Valid shortcut objects contain the following fields.
102
+
Valid shortcut objects contain the following properties.
103
103
104
104
`+title+`:: A string which is displayed in the `+aishortcuts+` toolbar button and menu item. This will indicate which shortcut is used, or which category of shortcuts are in this menu.
105
105
106
106
And either
107
107
108
-
`+prompt+`:: A string containing the query which is given to the `+ai_request+` function when the shortcut is used.
108
+
`+subprompts+`:: An array containing more valid shortcut objects. This allows shortcuts to be grouped into categories within the {pluginname} shortcuts toolbar button and menu item.
109
109
110
110
or
111
111
112
-
`+subprompts+`:: An array containing more valid shortcut objects. This allows shortcuts to be grouped into categories within the {pluginname} shortcuts toolbar button and menu item.
112
+
`+prompt+`:: A string containing the query which is given to the `+ai_request+` function when the shortcut is used.
113
+
114
+
115
+
==== The `+selection+` property
116
+
117
+
include::partial$misc/admon-requires-6.8v.adoc[]
118
+
119
+
Shortcut objects with the `+prompt+` property may also contain the following optional property.
120
+
121
+
`+selection+`:: A boolean value which will match to the current selection and set the enabled state of the shortcut. When `+selection+` is:
122
+
123
+
* `+true+`: The shortcut will _only_ be enabled when the user _has_ made a selection in the editor.
124
+
125
+
* `+false+`: The shortcut will _only_ be enabled when the user _has not_ made a selection in the editor.
126
+
127
+
* `+undefined+`, or _not set_: The shortcut will always be enabled.
128
+
129
+
This property allows the definition of shortcuts which should only operate when the user has selected content, requiring the selection as context to the AI when the property is `+true+`. Additionally, shortcuts which are intended to generate specific content will not be enabled with any selection when the property if `+false+`.
0 commit comments