@ckeditor/ckeditor5-html-embed 36.0.1 → 37.0.0-alpha.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/build/html-embed.js +1 -1
- package/package.json +22 -17
- package/src/htmlembed.d.ts +30 -0
- package/src/htmlembed.js +12 -104
- package/src/htmlembedcommand.d.ts +49 -0
- package/src/htmlembedcommand.js +70 -91
- package/src/htmlembedconfig.d.ts +96 -0
- package/src/htmlembedconfig.js +5 -0
- package/src/htmlembedediting.d.ts +45 -0
- package/src/htmlembedediting.js +308 -379
- package/src/htmlembedui.d.ts +26 -0
- package/src/htmlembedui.js +34 -46
- package/src/index.d.ts +10 -0
- package/src/index.js +0 -2
|
@@ -0,0 +1,26 @@
|
|
|
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 html-embed/htmlembedui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
/**
|
|
10
|
+
* The HTML embed UI plugin.
|
|
11
|
+
*/
|
|
12
|
+
export default class HtmlEmbedUI extends Plugin {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
static get pluginName(): 'HtmlEmbedUI';
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
init(): void;
|
|
21
|
+
}
|
|
22
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
23
|
+
interface PLuginsMap {
|
|
24
|
+
[HtmlEmbedUI.pluginName]: HtmlEmbedUI;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/htmlembedui.js
CHANGED
|
@@ -2,60 +2,48 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module html-embed/htmlembedui
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import { ButtonView } from 'ckeditor5/src/ui';
|
|
12
|
-
|
|
13
10
|
import htmlEmbedIcon from '../theme/icons/html.svg';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* The HTML embed UI plugin.
|
|
17
|
-
*
|
|
18
|
-
* @extends module:core/plugin~Plugin
|
|
19
13
|
*/
|
|
20
14
|
export default class HtmlEmbedUI extends Plugin {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
widgetWrapper.getCustomProperty( 'rawHtmlApi' ).makeEditable();
|
|
56
|
-
} );
|
|
57
|
-
|
|
58
|
-
return view;
|
|
59
|
-
} );
|
|
60
|
-
}
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get pluginName() {
|
|
19
|
+
return 'HtmlEmbedUI';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
init() {
|
|
25
|
+
const editor = this.editor;
|
|
26
|
+
const t = editor.t;
|
|
27
|
+
// Add the `htmlEmbed` button to feature components.
|
|
28
|
+
editor.ui.componentFactory.add('htmlEmbed', locale => {
|
|
29
|
+
const command = editor.commands.get('htmlEmbed');
|
|
30
|
+
const view = new ButtonView(locale);
|
|
31
|
+
view.set({
|
|
32
|
+
label: t('Insert HTML'),
|
|
33
|
+
icon: htmlEmbedIcon,
|
|
34
|
+
tooltip: true
|
|
35
|
+
});
|
|
36
|
+
view.bind('isEnabled').to(command, 'isEnabled');
|
|
37
|
+
// Execute the command.
|
|
38
|
+
this.listenTo(view, 'execute', () => {
|
|
39
|
+
editor.execute('htmlEmbed');
|
|
40
|
+
editor.editing.view.focus();
|
|
41
|
+
const rawHtmlApi = editor.editing.view.document.selection
|
|
42
|
+
.getSelectedElement()
|
|
43
|
+
.getCustomProperty('rawHtmlApi');
|
|
44
|
+
rawHtmlApi.makeEditable();
|
|
45
|
+
});
|
|
46
|
+
return view;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
61
49
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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 html-embed
|
|
7
|
+
*/
|
|
8
|
+
export { default as HtmlEmbed } from './htmlembed';
|
|
9
|
+
export { default as HtmlEmbedEditing } from './htmlembedediting';
|
|
10
|
+
export { default as HtmlEmbedUI } from './htmlembedui';
|
package/src/index.js
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module html-embed
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
export { default as HtmlEmbed } from './htmlembed';
|
|
11
9
|
export { default as HtmlEmbedEditing } from './htmlembedediting';
|
|
12
10
|
export { default as HtmlEmbedUI } from './htmlembedui';
|