@ckeditor/ckeditor5-slash-command 0.0.1 → 37.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +35 -3
- package/build/slash-command.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +11 -0
- package/lang/contexts.json +24 -0
- package/lang/translations/ar.po +105 -0
- package/lang/translations/bg.po +105 -0
- package/lang/translations/bn.po +105 -0
- package/lang/translations/ca.po +105 -0
- package/lang/translations/cs.po +105 -0
- package/lang/translations/da.po +105 -0
- package/lang/translations/de.po +105 -0
- package/lang/translations/el.po +105 -0
- package/lang/translations/en.po +105 -0
- package/lang/translations/es.po +105 -0
- package/lang/translations/et.po +105 -0
- package/lang/translations/fi.po +105 -0
- package/lang/translations/fr.po +105 -0
- package/lang/translations/he.po +105 -0
- package/lang/translations/hi.po +105 -0
- package/lang/translations/hr.po +105 -0
- package/lang/translations/hu.po +105 -0
- package/lang/translations/id.po +105 -0
- package/lang/translations/it.po +105 -0
- package/lang/translations/ja.po +105 -0
- package/lang/translations/ko.po +105 -0
- package/lang/translations/lt.po +105 -0
- package/lang/translations/lv.po +105 -0
- package/lang/translations/ms.po +105 -0
- package/lang/translations/nl.po +105 -0
- package/lang/translations/no.po +105 -0
- package/lang/translations/pl.po +105 -0
- package/lang/translations/pt-br.po +105 -0
- package/lang/translations/pt.po +105 -0
- package/lang/translations/ro.po +105 -0
- package/lang/translations/ru.po +105 -0
- package/lang/translations/sk.po +105 -0
- package/lang/translations/sr.po +105 -0
- package/lang/translations/sv.po +105 -0
- package/lang/translations/th.po +105 -0
- package/lang/translations/tr.po +105 -0
- package/lang/translations/uk.po +105 -0
- package/lang/translations/vi.po +105 -0
- package/lang/translations/zh-cn.po +105 -0
- package/lang/translations/zh.po +105 -0
- package/package.json +35 -4
- package/src/augmentation.d.ts +21 -0
- package/src/augmentation.js +23 -0
- package/src/index.d.ts +13 -0
- package/src/index.js +23 -0
- package/src/slashcommand.d.ts +27 -0
- package/src/slashcommand.js +23 -0
- package/src/slashcommandconfig.d.ts +242 -0
- package/src/slashcommandconfig.js +23 -0
- package/src/slashcommandediting.d.ts +37 -0
- package/src/slashcommandediting.js +23 -0
- package/src/slashcommandeditorconfig.d.ts +96 -0
- package/src/slashcommandeditorconfig.js +23 -0
- package/src/slashcommandui.d.ts +33 -0
- package/src/slashcommandui.js +23 -0
- package/src/ui/slashcommandbuttonview.d.ts +31 -0
- package/src/ui/slashcommandbuttonview.js +23 -0
- package/theme/icons/play.svg +1 -0
- package/theme/slashcommand.css +73 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module slash-command/slashcommandconfig
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
import './slashcommandeditorconfig';
|
|
11
|
+
/**
|
|
12
|
+
* This plugin takes care of the configuration for {@link module:slash-command/slashcommand~SlashCommand}:
|
|
13
|
+
*
|
|
14
|
+
* * It manages the configuration of slash commands in the editor.
|
|
15
|
+
* * It provides default slash commands for common editor features.
|
|
16
|
+
* * It allows defining extra commands and reducing the list of defaults using the editor configuration.
|
|
17
|
+
* See {@link module:slash-command/slashcommandconfig~SlashCommandConfig} to learn more.
|
|
18
|
+
*
|
|
19
|
+
* @extends module:core/plugin~Plugin
|
|
20
|
+
*/
|
|
21
|
+
export default class SlashCommandConfig extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName(): 'SlashCommandConfig';
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
constructor(editor: Editor);
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
afterInit(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Returns an array of slash command definitions enabled in the editor.
|
|
36
|
+
*
|
|
37
|
+
* This method takes into account the following:
|
|
38
|
+
* * The {@link module:slash-command/slashcommandconfig~SlashCommandConfig#getDefaultCommands list of default commands}.
|
|
39
|
+
* * The presence of {@link module:core/editor/editorconfig~EditorConfig#plugins editor features} (plugins).
|
|
40
|
+
* * The {@link module:slash-command/slashcommandeditorconfig~SlashCommandEditorConfig#removeCommands} configuration.
|
|
41
|
+
* * The {@link module:slash-command/slashcommandeditorconfig~SlashCommandEditorConfig#extraCommands} configuration.
|
|
42
|
+
*/
|
|
43
|
+
getAllowedCommands(): Array<SlashCommandDefinition>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a list of default slash command {@link module:slash-command/slashcommandconfig~SlashCommandDefinition definitions}
|
|
46
|
+
* for common editor features. The available definitions are as follows:
|
|
47
|
+
*
|
|
48
|
+
* ```js
|
|
49
|
+
* [
|
|
50
|
+
* {
|
|
51
|
+
* id: 'blockQuote',
|
|
52
|
+
* commandName: 'blockQuote',
|
|
53
|
+
* title: t( 'Block quote' ),
|
|
54
|
+
* // ...
|
|
55
|
+
* },
|
|
56
|
+
* {
|
|
57
|
+
* id: 'bulletedList',
|
|
58
|
+
* commandName: 'bulletedList',
|
|
59
|
+
* title: t( 'Bulleted list' ),
|
|
60
|
+
* // ...
|
|
61
|
+
* },
|
|
62
|
+
* {
|
|
63
|
+
* id: 'codeBlock',
|
|
64
|
+
* commandName: 'codeBlock',
|
|
65
|
+
* title: t( 'Insert code block' ),
|
|
66
|
+
* // ...
|
|
67
|
+
* },
|
|
68
|
+
* {
|
|
69
|
+
* id: 'ckbox',
|
|
70
|
+
* commandName: 'ckbox',
|
|
71
|
+
* title: t( 'Open file manager' ),
|
|
72
|
+
* // ...
|
|
73
|
+
* },
|
|
74
|
+
* {
|
|
75
|
+
* id: 'ckfinder',
|
|
76
|
+
* commandName: 'ckfinder',
|
|
77
|
+
* title: t( 'Insert image' ),
|
|
78
|
+
* // ...
|
|
79
|
+
* },
|
|
80
|
+
* {
|
|
81
|
+
* id: 'heading1',
|
|
82
|
+
* commandName: 'heading',
|
|
83
|
+
* title: t( 'Heading 1' ),
|
|
84
|
+
* // ...
|
|
85
|
+
* },
|
|
86
|
+
* {
|
|
87
|
+
* id: 'heading2',
|
|
88
|
+
* commandName: 'heading',
|
|
89
|
+
* title: t( 'Heading 2' ),
|
|
90
|
+
* // ...
|
|
91
|
+
* },
|
|
92
|
+
* {
|
|
93
|
+
* id: 'heading3',
|
|
94
|
+
* commandName: 'heading',
|
|
95
|
+
* title: t( 'Heading 3' ),
|
|
96
|
+
* // ...
|
|
97
|
+
* },
|
|
98
|
+
* {
|
|
99
|
+
* id: 'heading4',
|
|
100
|
+
* commandName: 'heading',
|
|
101
|
+
* title: t( 'Heading 4' ),
|
|
102
|
+
* // ...
|
|
103
|
+
* },
|
|
104
|
+
* {
|
|
105
|
+
* id: 'heading5',
|
|
106
|
+
* commandName: 'heading',
|
|
107
|
+
* title: t( 'Heading 5' ),
|
|
108
|
+
* // ...
|
|
109
|
+
* },
|
|
110
|
+
* {
|
|
111
|
+
* id: 'heading6',
|
|
112
|
+
* commandName: 'heading',
|
|
113
|
+
* title: t( 'Heading 6' ),
|
|
114
|
+
* // ...
|
|
115
|
+
* },
|
|
116
|
+
* {
|
|
117
|
+
* id: 'horizontalLine',
|
|
118
|
+
* commandName: 'horizontalLine',
|
|
119
|
+
* title: t( 'Horizontal line' ),
|
|
120
|
+
* // ...
|
|
121
|
+
* },
|
|
122
|
+
* {
|
|
123
|
+
* id: 'htmlEmbed',
|
|
124
|
+
* commandName: 'htmlEmbed',
|
|
125
|
+
* title: t( 'Insert HTML' ),
|
|
126
|
+
* // ...
|
|
127
|
+
* },
|
|
128
|
+
* {
|
|
129
|
+
* id: 'indent',
|
|
130
|
+
* commandName: 'indent',
|
|
131
|
+
* title: t( 'Increase indent' ),
|
|
132
|
+
* // ...
|
|
133
|
+
* },
|
|
134
|
+
* {
|
|
135
|
+
* id: 'insertMermaidCommand',
|
|
136
|
+
* commandName: 'insertMermaidCommand',
|
|
137
|
+
* title: t( 'Insert Mermaid diagram' ),
|
|
138
|
+
* // ...
|
|
139
|
+
* },
|
|
140
|
+
* {
|
|
141
|
+
* id: 'insertTable',
|
|
142
|
+
* commandName: 'insertTable',
|
|
143
|
+
* title: t( 'Insert table' ),
|
|
144
|
+
* // ...
|
|
145
|
+
* },
|
|
146
|
+
* {
|
|
147
|
+
* id: 'insertTableOfContents',
|
|
148
|
+
* commandName: 'insertTableOfContents',
|
|
149
|
+
* title: t( 'Table of contents' ),
|
|
150
|
+
* // ...
|
|
151
|
+
* },
|
|
152
|
+
* {
|
|
153
|
+
* id: 'numberedList',
|
|
154
|
+
* commandName: 'numberedList',
|
|
155
|
+
* title: t( 'Numbered list' ),
|
|
156
|
+
* // ...
|
|
157
|
+
* },
|
|
158
|
+
* {
|
|
159
|
+
* id: 'outdent',
|
|
160
|
+
* commandName: 'outdent',
|
|
161
|
+
* title: t( 'Decrease indent' ),
|
|
162
|
+
* // ...
|
|
163
|
+
* },
|
|
164
|
+
* {
|
|
165
|
+
* id: 'paragraph',
|
|
166
|
+
* commandName: 'paragraph',
|
|
167
|
+
* title: t( 'Paragraph' ),
|
|
168
|
+
* // ...
|
|
169
|
+
* },
|
|
170
|
+
* {
|
|
171
|
+
* id: 'todoList',
|
|
172
|
+
* commandName: 'todoList',
|
|
173
|
+
* title: t( 'To-do list' ),
|
|
174
|
+
* // ...
|
|
175
|
+
* }
|
|
176
|
+
* ]
|
|
177
|
+
*/
|
|
178
|
+
getDefaultCommands(): Array<SlashCommandDefinition>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* An object describing a single command definition in the configuration.
|
|
182
|
+
*/
|
|
183
|
+
export interface SlashCommandDefinition {
|
|
184
|
+
/**
|
|
185
|
+
* A unique ID matched with the text that follows the slash ("/") character typed by the user,
|
|
186
|
+
* e.g. 'blockQuote', 'heading1'. See {@link module:slash-command/slashcommandconfig~SlashCommandDefinition#aliases}
|
|
187
|
+
* to learn about slash command aliases that provide a similar functionality.
|
|
188
|
+
*/
|
|
189
|
+
id: string;
|
|
190
|
+
/**
|
|
191
|
+
* The name of the command to be executed if the `execute` property was not provided,
|
|
192
|
+
* for example, 'blockQuote', 'heading'. See {@link module:core/editor/editor~Editor#commands} to learn more about available commands.
|
|
193
|
+
*/
|
|
194
|
+
commandName?: string;
|
|
195
|
+
/**
|
|
196
|
+
* A meaningful title for the command displayed in a dropdown list of possible commands. It can be a string
|
|
197
|
+
* or a callback function returning a string.
|
|
198
|
+
*/
|
|
199
|
+
title: Function | string;
|
|
200
|
+
/**
|
|
201
|
+
* An optional description for the command. Useful when the title is not descriptive enough.
|
|
202
|
+
*/
|
|
203
|
+
description?: string;
|
|
204
|
+
/**
|
|
205
|
+
* An SVG string representing the icon of the command. If not provided, a generic icon will be used instead.
|
|
206
|
+
* The default size of the icon is 20x20 pixels. Be sure to set the correct `viewBox` attribute in the icon source.
|
|
207
|
+
*
|
|
208
|
+
* See {@link module:slash-command/slashcommandconfig~SlashCommandDefinition#isIconColorInherited}.
|
|
209
|
+
*/
|
|
210
|
+
icon?: string;
|
|
211
|
+
/**
|
|
212
|
+
* By default, slash command icons are monochromatic and inherit the color of the text in the editor UI.
|
|
213
|
+
* Setting this property to `false` disables this inheritance and allows the use of complex (colorful) icons.
|
|
214
|
+
*
|
|
215
|
+
* Learn more in {@link module:ui/icon/iconview~IconView#isColorInherited}.
|
|
216
|
+
*/
|
|
217
|
+
isIconColorInherited?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* An optional list of aliases (extending the base
|
|
220
|
+
* {@link module:slash-command/slashcommandconfig~SlashCommandDefinition#id}) to be used when filtering the list of slash commands
|
|
221
|
+
* based on the text that follows the slash ("/") character.
|
|
222
|
+
*/
|
|
223
|
+
aliases?: Array<string>;
|
|
224
|
+
/**
|
|
225
|
+
* A callback function defining custom logic to decide if the command should be displayed
|
|
226
|
+
* in the dropdown list. If not provided, the default command's {@link module:core/command~Command#isEnabled} property is used instead.
|
|
227
|
+
* If it's also unavailable, it falls back to `true`. This property is checked when a user types the slash ("/") character
|
|
228
|
+
* or changes the text that follows it.
|
|
229
|
+
*
|
|
230
|
+
* This callback gets an {@link module:core/editor/editor~Editor} instance as a parameter.
|
|
231
|
+
*/
|
|
232
|
+
isEnabled?: Function;
|
|
233
|
+
/**
|
|
234
|
+
* A callback function defining custom logic for executing the command. If not provided, the default
|
|
235
|
+
* command's {@link module:core/command~Command#execute} is used instead. Custom logic is useful especially when the slash command
|
|
236
|
+
* requires some arguments (acts like a wrapper) or combines some complex logic. This property is obligatory if
|
|
237
|
+
* {@link module:slash-command/slashcommandconfig~SlashCommandDefinition#commandName} was not passed.
|
|
238
|
+
*
|
|
239
|
+
* This callback gets an {@link module:core/editor/editor~Editor} instance as a parameter.
|
|
240
|
+
*/
|
|
241
|
+
execute?: Function;
|
|
242
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
import{Plugin as _0x24c05e,icons as _0x2f93af}from'ckeditor5/src/core';import{CKEditorError as _0x346dd3}from'ckeditor5/src/utils';import _0x14a784 from'@ckeditor/ckeditor5-list/theme/icons/bulletedlist.svg';import _0xa76064 from'@ckeditor/ckeditor5-code-block/theme/icons/codeblock.svg';import _0x4abd43 from'@ckeditor/ckeditor5-ckbox/theme/icons/browse-files.svg';import _0x26f450 from'@ckeditor/ckeditor5-ckfinder/theme/icons/browse-files.svg';import _0x3a657a from'@ckeditor/ckeditor5-heading/theme/icons/heading1.svg';import _0x99633c from'@ckeditor/ckeditor5-heading/theme/icons/heading2.svg';import _0x35830a from'@ckeditor/ckeditor5-heading/theme/icons/heading3.svg';import _0x217e28 from'@ckeditor/ckeditor5-heading/theme/icons/heading4.svg';import _0x453fc5 from'@ckeditor/ckeditor5-heading/theme/icons/heading5.svg';import _0x34e23a from'@ckeditor/ckeditor5-heading/theme/icons/heading6.svg';import _0x99ef5 from'@ckeditor/ckeditor5-horizontal-line/theme/icons/horizontalline.svg';import _0x5be08b from'@ckeditor/ckeditor5-html-embed/theme/icons/html.svg';import _0x436b49 from'@ckeditor/ckeditor5-indent/theme/icons/indent.svg';import _0xef54de from'@ckeditor/ckeditor5-table/theme/icons/table.svg';import _0x1407d4 from'@ckeditor/ckeditor5-list/theme/icons/numberedlist.svg';import _0x4aec4e from'@ckeditor/ckeditor5-indent/theme/icons/outdent.svg';import _0x1a4435 from'@ckeditor/ckeditor5-document-outline/theme/icons/table-of-contents.svg';import _0x312d8f from'@ckeditor/ckeditor5-list/theme/icons/todolist.svg';import'./slashcommandeditorconfig';export default class T extends _0x24c05e{static get['pluginName'](){return'SlashCommandConfig';}constructor(_0x4b27d5){super(_0x4b27d5),this['_allowedCommands']=null;}['afterInit'](){const _0x4d35ba=this['editor']['config']['get']('slashCommand.removeCommands')||[],_0x193060=function(_0x22bd07){let _0x37b74f=['heading4','heading5','heading6'];if(_0x22bd07){const _0x30df6c=_0x22bd07['map'](_0x529e93=>_0x529e93['model']);_0x37b74f=['heading1','heading2','heading3','heading4','heading5','heading6']['filter'](_0x2fef6e=>!_0x30df6c['includes'](_0x2fef6e));}return _0x37b74f;}(this['editor']['config']['get']('heading.options'));let _0x29a4d7=this['getDefaultCommands']()['filter'](_0x515d37=>!_0x193060['includes'](_0x515d37['id']))['filter'](_0x5a8084=>!_0x4d35ba['includes'](_0x5a8084['commandName']));const _0x34a6e4=this['editor']['config']['get']('slashCommand.extraCommands');_0x34a6e4&&_0x34a6e4['length']&&(_0x29a4d7=_0x29a4d7['concat'](_0x34a6e4));const _0x40efc4=this['editor']['config']['get']('template.definitions');_0x40efc4&&_0x40efc4['length']&&(_0x29a4d7=_0x29a4d7['concat'](function(_0x1b4b15){return _0x1b4b15['map'](_0x5090a5=>{const {title:_0x16c14f,icon:_0x5bc118,description:_0x5ba1d4,data:_0x43c021}=_0x5090a5,_0x3690af={'id':H(_0x16c14f,'template'),'commandName':'insertTemplate','execute':_0x4e8864=>{_0x4e8864['execute']('insertTemplate',_0x43c021);},'description':_0x5ba1d4,'icon':_0x5bc118,'title':_0x16c14f};return _0x5bc118&&(_0x3690af['isIconColorInherited']=!0x1),_0x3690af;});}(_0x40efc4)));const _0x51663e=this['editor']['config']['get']('style.definitions');_0x51663e&&_0x51663e['length']&&(_0x29a4d7=_0x29a4d7['concat'](function(_0xea5e82){return _0xea5e82['map'](_0x5ea0f6=>({'id':H(_0x5ea0f6['name'],'style'),'commandName':'style','execute':_0x1b0078=>{_0x1b0078['execute']('style',{'styleName':_0x5ea0f6['name']});},'isEnabled':_0x204fd4=>{const _0x138acf=_0x204fd4['commands']['get']('style');return _0x138acf['isEnabled']&&_0x138acf['enabledStyles']['includes'](_0x5ea0f6['name']);},'title':_0x5ea0f6['name']}));}(_0x51663e)));const _0x1c9597=_0x29a4d7['filter'](_0x236df1=>!_0x236df1['commandName']||void 0x0!==this['editor']['commands']['get'](_0x236df1['commandName'])),_0x5dfd7a=[];for(const _0xa0c2fd of _0x1c9597)_0x5dfd7a['push']({'id':_0xa0c2fd['id'],'commandName':_0xa0c2fd['commandName'],'title':'function'==typeof _0xa0c2fd['title']?_0xa0c2fd['title'](this['editor']):_0xa0c2fd['title'],'description':_0xa0c2fd['description'],'icon':_0xa0c2fd['icon'],'isIconColorInherited':_0xa0c2fd['isIconColorInherited'],'aliases':_0xa0c2fd['aliases'],'isEnabled':()=>this['_proxyIsEnabled'](_0xa0c2fd),'execute':()=>this['_proxyExecute'](_0xa0c2fd)});this['_allowedCommands']=_0x5dfd7a['sort'](y);}['getAllowedCommands'](){return this['_allowedCommands'];}['getDefaultCommands'](){const t=this['editor']['t'],_0x10dc28=this['editor']['locale']['t'];return[{'id':'blockQuote','commandName':'blockQuote','icon':_0x2f93af['quote'],'title':_0x10dc28('Block\x20quote'),'description':t('Create\x20a\x20block\x20quote')},{'id':'bulletedList','commandName':'bulletedList','icon':_0x14a784,'title':_0x10dc28('Bulleted\x20list'),'description':t('Create\x20a\x20bulleted\x20list')},{'id':'codeBlock','commandName':'codeBlock','icon':_0xa76064,'title':_0x10dc28('Insert\x20code\x20block'),'description':t('Create\x20a\x20code\x20block')},{'id':'ckbox','commandName':'ckbox','icon':_0x4abd43,'title':_0x10dc28('Open\x20file\x20manager'),'description':t('Open\x20file\x20manager\x20to\x20insert\x20an\x20image\x20or\x20a\x20file'),'aliases':['ckfinder','filemanager','upload']},{'id':'ckfinder','commandName':'ckfinder','icon':_0x26f450,'title':_0x10dc28('Insert\x20image'),'description':t('Open\x20file\x20browser\x20to\x20insert\x20an\x20image\x20or\x20a\x20file'),'aliases':['ckbox','filemanager','upload']},{'id':'heading1','commandName':'heading','icon':_0x3a657a,'title':_0x10dc28('Heading\x201'),'description':t('Create\x20a\x20heading\x20level\x201'),'execute':_0xe480eb=>{_0xe480eb['execute']('heading',{'value':'heading1'});}},{'id':'heading2','commandName':'heading','icon':_0x99633c,'title':_0x10dc28('Heading\x202'),'description':t('Create\x20a\x20heading\x20level\x202'),'execute':_0x5d0d54=>{_0x5d0d54['execute']('heading',{'value':'heading2'});}},{'id':'heading3','commandName':'heading','icon':_0x35830a,'title':_0x10dc28('Heading\x203'),'description':t('Create\x20a\x20heading\x20level\x203'),'execute':_0x12b326=>{_0x12b326['execute']('heading',{'value':'heading3'});}},{'id':'heading4','commandName':'heading','icon':_0x217e28,'title':_0x10dc28('Heading\x204'),'description':t('Create\x20a\x20heading\x20level\x204'),'execute':_0x125f55=>{_0x125f55['execute']('heading',{'value':'heading4'});}},{'id':'heading5','commandName':'heading','icon':_0x453fc5,'title':_0x10dc28('Heading\x205'),'description':t('Create\x20a\x20heading\x20level\x205'),'execute':_0x1574b5=>{_0x1574b5['execute']('heading',{'value':'heading5'});}},{'id':'heading6','commandName':'heading','icon':_0x34e23a,'title':_0x10dc28('Heading\x206'),'description':t('Create\x20a\x20heading\x20level\x206'),'execute':_0x2a42fa=>{_0x2a42fa['execute']('heading',{'value':'heading6'});}},{'id':'horizontalLine','commandName':'horizontalLine','icon':_0x99ef5,'title':_0x10dc28('Horizontal\x20line'),'description':t('Insert\x20a\x20horizontal\x20line')},{'id':'htmlEmbed','commandName':'htmlEmbed','icon':_0x5be08b,'title':_0x10dc28('Insert\x20HTML'),'description':t('Insert\x20an\x20HTML\x20snippet')},{'id':'indent','commandName':'indent','icon':_0x436b49,'title':_0x10dc28('Increase\x20indent'),'description':t('Increase\x20the\x20indentation')},{'id':'insertMermaidCommand','commandName':'insertMermaidCommand','title':t('Insert\x20Mermaid\x20diagram'),'description':t('Insert\x20the\x20Mermaid\x20diagram')},{'id':'insertTable','commandName':'insertTable','icon':_0xef54de,'title':_0x10dc28('Insert\x20table'),'description':t('Create\x20a\x20table')},{'id':'insertTableOfContents','commandName':'insertTableOfContents','icon':_0x1a4435,'title':_0x10dc28('Table\x20of\x20contents'),'description':t('Insert\x20table\x20of\x20contents'),'aliases':['toc']},{'id':'numberedList','commandName':'numberedList','icon':_0x1407d4,'title':_0x10dc28('Numbered\x20list'),'description':t('Create\x20a\x20numbered\x20list')},{'id':'outdent','commandName':'outdent','icon':_0x4aec4e,'title':_0x10dc28('Decrease\x20indent'),'description':t('Decrease\x20the\x20indentation')},{'id':'paragraph','commandName':'paragraph','icon':_0x2f93af['paragraph'],'title':_0x10dc28('Paragraph'),'description':t('Insert\x20a\x20paragraph')},{'id':'todoList','commandName':'todoList','icon':_0x312d8f,'title':_0x10dc28('To-do\x20list'),'description':t('Create\x20a\x20to-do\x20list')}];}['_proxyIsEnabled'](_0x54c1ae){return _0x54c1ae['isEnabled']?_0x54c1ae['isEnabled'](this['editor']):!_0x54c1ae['commandName']||this['editor']['commands']['get'](_0x54c1ae['commandName'])['isEnabled'];}['_proxyExecute'](_0x4c8086){if(_0x4c8086['execute'])_0x4c8086['execute'](this['editor']);else{if(!_0x4c8086['commandName'])throw new _0x346dd3('slash-command-execute-missing',this['editor'],{'commandDefinition':_0x4c8086});this['editor']['execute'](_0x4c8086['commandName']);}}}function y(_0x4a42f8,_0x3543e7){return _0x4a42f8['title']<_0x3543e7['title']?-0x1:_0x4a42f8['title']>_0x3543e7['title']?0x1:0x0;}function H(_0x899504,_0x5bf2fd){return _0x5bf2fd+'-'+_0x899504['toLowerCase']()['split']('\x20')['join']('-');}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module slash-command/slashcommandediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependencies, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import { type SlashCommandDefinition } from './slashcommandconfig';
|
|
10
|
+
/**
|
|
11
|
+
* Provides the editing functionality of the {@link module:slash-command/slashcommand~SlashCommand} feature.
|
|
12
|
+
*
|
|
13
|
+
* @extends module:core/plugin~Plugin
|
|
14
|
+
*/
|
|
15
|
+
export default class SlashCommandEditing extends Plugin {
|
|
16
|
+
licenseKey: string;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): 'SlashCommandEditing';
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get requires(): PluginDependencies;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
constructor(editor: Editor);
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
init(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the list of matching enabled command definitions for the specific query text case-insensitively.
|
|
35
|
+
*/
|
|
36
|
+
getMatchingCommands(queryString: string): Array<SlashCommandDefinition>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x5b51=['push','slashCommandLicenseKeyTrialLimit:operations','You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20slash\x20command\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.','licenseKey','filter','pluginName','SlashCommandEditing','slashCommandLicenseKeyInvalid','_licenseKeyCheckInterval','slashCommandLicenseKeyTrial','toLowerCase','get','concat','SlashCommandConfig','slash-command-invalid-license-key','slash-command-trial-license-key-reached-limit-changes','isEnabled','slashCommandLicenseKeyValid','aliases','getMatchingCommands','config','description','plugins','editor','init','info','getAllowedCommands','some','includes'];(function(_0x5486f4,_0x5b5189){const _0xb71838=function(_0x29d990){while(--_0x29d990){_0x5486f4['push'](_0x5486f4['shift']());}};_0xb71838(++_0x5b5189);}(_0x5b51,0x1c7));const _0xb718=function(_0x5486f4,_0x5b5189){_0x5486f4=_0x5486f4-0x0;let _0xb71838=_0x5b51[_0x5486f4];return _0xb71838;};import{Plugin as _0x213998}from'ckeditor5/src/core';import{CKEditorError as _0x504b77}from'ckeditor5/src/utils';import _0x599d51 from'./slashcommandconfig';export default class e extends _0x213998{static get[_0xb718('0xe')](){return _0xb718('0xf');}static get['requires'](){return[_0x599d51];}constructor(_0x530f5f){super(_0x530f5f),this[_0xb718('0x11')]=null;}[_0xb718('0x4')](){const _0xc3586=this['editor'];this[_0xb718('0xc')]=_0xc3586[_0xb718('0x0')][_0xb718('0x14')]('licenseKey');const _0x571242=this['editor'];this[_0xb718('0x11')]=setInterval(()=>{let _0x1d5b19;for(const _0x307f33 in _0x571242){const _0xfe5701=_0x307f33,_0x8e6db7=_0x571242[_0xfe5701];if('slashCommandLicenseKeyTrial'===_0x8e6db7||'slashCommandLicenseKeyInvalid'===_0x8e6db7||_0xb718('0x1a')===_0x8e6db7||_0xb718('0xa')===_0x8e6db7){delete _0x571242[_0xfe5701],_0x1d5b19=_0x8e6db7;break;}}if(_0xb718('0x10')===_0x1d5b19)throw clearInterval(this[_0xb718('0x11')]),new _0x504b77(_0xb718('0x17'),null);if(_0xb718('0x12')===_0x1d5b19&&console[_0xb718('0x5')](_0xb718('0xb')),_0xb718('0xa')===_0x1d5b19)throw clearInterval(this[_0xb718('0x11')]),new _0x504b77(_0xb718('0x18'),null);_0xb718('0x1a')===_0x1d5b19&&clearInterval(this[_0xb718('0x11')]);},0x3e8);}[_0xb718('0x1c')](_0x5de6d6){const _0x5028b2=_0x5de6d6&&_0x5de6d6[_0xb718('0x13')]();let _0x534562=this[_0xb718('0x3')][_0xb718('0x2')][_0xb718('0x14')](_0xb718('0x16'))[_0xb718('0x6')]();if(_0x534562=_0x534562[_0xb718('0xd')](_0x196d19=>_0x196d19[_0xb718('0x19')]()),_0x5028b2){const _0x395176=[],_0x4a8961=[],_0x3a9b18=[],_0x2415ba=[];for(const _0x180d06 of _0x534562)_0x180d06['id'][_0xb718('0x13')]()['includes'](_0x5028b2)?_0x395176[_0xb718('0x9')](_0x180d06):_0x180d06['title'][_0xb718('0x13')]()[_0xb718('0x8')](_0x5028b2)?_0x4a8961[_0xb718('0x9')](_0x180d06):_0x180d06['aliases']&&_0x180d06[_0xb718('0x1b')][_0xb718('0x7')](_0x233146=>_0x233146[_0xb718('0x13')]()[_0xb718('0x8')](_0x5028b2))?_0x3a9b18[_0xb718('0x9')](_0x180d06):_0x180d06[_0xb718('0x1')]&&_0x180d06[_0xb718('0x1')][_0xb718('0x13')]()[_0xb718('0x8')](_0x5028b2)&&_0x2415ba[_0xb718('0x9')](_0x180d06);_0x534562=_0x395176[_0xb718('0x15')](_0x4a8961,_0x3a9b18,_0x2415ba);}return _0x534562;}}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module slash-command/slashcommandeditorconfig
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import type { SlashCommandDefinition } from './slashcommandconfig';
|
|
10
|
+
/**
|
|
11
|
+
* The configuration of the slash command feature.
|
|
12
|
+
*
|
|
13
|
+
* Read more about {@glink features/slash-commands#configuration configuring the slash command feature}.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* ClassicEditor
|
|
17
|
+
* .create( editorElement, {
|
|
18
|
+
* slashCommand: ... // Slash command feature options.
|
|
19
|
+
* } )
|
|
20
|
+
* .then( ... )
|
|
21
|
+
* .catch( ... );
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
25
|
+
*/
|
|
26
|
+
export interface SlashCommandEditorConfig {
|
|
27
|
+
/**
|
|
28
|
+
* The list of commands to be removed from the default command list. Commands specified by this configuration will not
|
|
29
|
+
* appear in the user interface upon writing the slash ("/") character.
|
|
30
|
+
*
|
|
31
|
+
* * Each entry must be a unique name of a command registered in the
|
|
32
|
+
* {@link module:core/editor/editor~Editor#commands editor's command collection}.
|
|
33
|
+
* * Check out the list of the {@link module:slash-command/slashcommandconfig~SlashCommandConfig#getDefaultCommands default commands}
|
|
34
|
+
* supported by the slash command feature to learn which commands can be removed.
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* ClassicEditor
|
|
38
|
+
* .create( editorElement, {
|
|
39
|
+
* plugins: [ SlashCommand, ... ],
|
|
40
|
+
* slashCommand: {
|
|
41
|
+
* removeCommands: [ 'heading', 'paragraph', ... ]
|
|
42
|
+
* // ...
|
|
43
|
+
* }
|
|
44
|
+
* } )
|
|
45
|
+
* .then( ... )
|
|
46
|
+
* .catch( ... );
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
removeCommands: Array<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Additional commands to be added to the
|
|
52
|
+
* {@link module:slash-command/slashcommandconfig~SlashCommandConfig#getDefaultCommands list of defaults} supported
|
|
53
|
+
* by the slash command feature. It allows the feature to work with third-party commands and make them appear in the user interface
|
|
54
|
+
* upon writing the slash ("/") character.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* ClassicEditor
|
|
58
|
+
* .create( editorElement, {
|
|
59
|
+
* plugins: [ SlashCommand, ... ],
|
|
60
|
+
* slashCommand: {
|
|
61
|
+
* extraCommands: [
|
|
62
|
+
* {
|
|
63
|
+
* id: 'bold',
|
|
64
|
+
* commandName: 'bold',
|
|
65
|
+
* title: 'Bold',
|
|
66
|
+
* // ...
|
|
67
|
+
* },
|
|
68
|
+
* // ...
|
|
69
|
+
* ]
|
|
70
|
+
* // ...
|
|
71
|
+
* }
|
|
72
|
+
* } )
|
|
73
|
+
* .then( ... )
|
|
74
|
+
* .catch( ... );
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
extraCommands: Array<SlashCommandDefinition>;
|
|
78
|
+
/**
|
|
79
|
+
* The maximum number of commands displayed in the dropdown list of slash commands.
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* ClassicEditor
|
|
83
|
+
* .create( editorElement, {
|
|
84
|
+
* plugins: [ SlashCommand, ... ],
|
|
85
|
+
* slashCommand: {
|
|
86
|
+
* dropdownLimit: 4
|
|
87
|
+
* // More of editor configuration.
|
|
88
|
+
* // ...
|
|
89
|
+
* }
|
|
90
|
+
* } )
|
|
91
|
+
* .then( ... )
|
|
92
|
+
* .catch( ... );
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
dropdownLimit: number;
|
|
96
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export{};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module slash-command/slashcommandui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import './slashcommandeditorconfig';
|
|
10
|
+
import '../theme/slashcommand.css';
|
|
11
|
+
/**
|
|
12
|
+
* Provides the UI functionality of the {@link module:slash-command/slashcommand~SlashCommand} feature.
|
|
13
|
+
*
|
|
14
|
+
* @extends module:core/plugin~Plugin
|
|
15
|
+
*/
|
|
16
|
+
export default class SlashCommandUI extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): 'SlashCommandUI';
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
constructor(editor: Editor);
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
init(): void;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
afterInit(): void;
|
|
33
|
+
}
|