@ckeditor/ckeditor5-core 43.3.1 → 44.0.0-alpha.1
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/README.md +13 -7
- package/dist/editor/editor.d.ts +32 -3
- package/dist/editor/editorconfig.d.ts +10 -8
- package/dist/editor/utils/editorusagedata.d.ts +72 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +436 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/editor/editor.d.ts +32 -3
- package/src/editor/editor.js +318 -1
- package/src/editor/editorconfig.d.ts +10 -8
- package/src/editor/utils/editorusagedata.d.ts +68 -0
- package/src/editor/utils/editorusagedata.js +127 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +7 -1
- package/src/plugincollection.js +1 -1
- package/theme/icons/bookmark.svg +1 -0
- package/theme/icons/bookmark_inline.svg +1 -0
- package/theme/icons/remove.svg +1 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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 core/editor/utils/editorusagedata
|
|
7
|
+
*/
|
|
8
|
+
import { env, global, uid } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
/**
|
|
10
|
+
* This part of the code is not executed in open-source implementations using a GPL key.
|
|
11
|
+
* It only runs when a specific license key is provided. If you are uncertain whether
|
|
12
|
+
* this applies to your installation, please contact our support team.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export function getEditorUsageData(editor) {
|
|
17
|
+
return {
|
|
18
|
+
sessionId: getSessionId(),
|
|
19
|
+
pageSessionId: getPageSessionID(),
|
|
20
|
+
hostname: window.location.hostname,
|
|
21
|
+
version: globalThis.CKEDITOR_VERSION,
|
|
22
|
+
type: getEditorType(editor),
|
|
23
|
+
plugins: getPluginsUsageData(editor.plugins),
|
|
24
|
+
distribution: getDistributionUsageData(),
|
|
25
|
+
env: getEnvUsageData(),
|
|
26
|
+
integration: Object.create(null),
|
|
27
|
+
menuBar: {
|
|
28
|
+
isVisible: !!editor.config.get('menuBar.isVisible')
|
|
29
|
+
},
|
|
30
|
+
language: {
|
|
31
|
+
ui: editor.locale.uiLanguage,
|
|
32
|
+
content: editor.locale.contentLanguage
|
|
33
|
+
},
|
|
34
|
+
toolbar: {
|
|
35
|
+
main: getToolbarUsageData(editor.config.get('toolbar')),
|
|
36
|
+
block: getToolbarUsageData(editor.config.get('blockToolbar')),
|
|
37
|
+
balloon: getToolbarUsageData(editor.config.get('balloonToolbar'))
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function getEditorType(editor) {
|
|
42
|
+
return Object.getPrototypeOf(editor).constructor.editorName;
|
|
43
|
+
}
|
|
44
|
+
function getPluginsUsageData(collection) {
|
|
45
|
+
return Array
|
|
46
|
+
.from(collection)
|
|
47
|
+
.filter(([PluginConstructor]) => !!PluginConstructor.pluginName)
|
|
48
|
+
.map(([PluginConstructor]) => {
|
|
49
|
+
const { pluginName, isContextPlugin, isOfficialPlugin, isPremiumPlugin } = PluginConstructor;
|
|
50
|
+
return {
|
|
51
|
+
isContext: !!isContextPlugin,
|
|
52
|
+
isOfficial: !!isOfficialPlugin,
|
|
53
|
+
isPremium: !!isPremiumPlugin,
|
|
54
|
+
name: pluginName
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function getToolbarUsageData(toolbarConfig) {
|
|
59
|
+
if (!toolbarConfig) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const normalizedToolbar = Array.isArray(toolbarConfig) ?
|
|
63
|
+
{ items: toolbarConfig } :
|
|
64
|
+
toolbarConfig;
|
|
65
|
+
const flattenToolbarConfigNames = extractToolbarConfigItemsNames(normalizedToolbar.items || []);
|
|
66
|
+
const isMultiline = flattenToolbarConfigNames.includes('-');
|
|
67
|
+
return {
|
|
68
|
+
isMultiline,
|
|
69
|
+
shouldNotGroupWhenFull: !!normalizedToolbar.shouldNotGroupWhenFull,
|
|
70
|
+
items: stripToolbarSeparatorItems(flattenToolbarConfigNames)
|
|
71
|
+
};
|
|
72
|
+
function stripToolbarSeparatorItems(items) {
|
|
73
|
+
return items.filter((item) => item !== '|' && item !== '-');
|
|
74
|
+
}
|
|
75
|
+
function extractToolbarConfigItemsNames(items) {
|
|
76
|
+
return items.flatMap(item => {
|
|
77
|
+
if (typeof item === 'string') {
|
|
78
|
+
return [item];
|
|
79
|
+
}
|
|
80
|
+
return extractToolbarConfigItemsNames(item.items);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getDistributionUsageData() {
|
|
85
|
+
return {
|
|
86
|
+
channel: (window[Symbol.for('cke distribution')] || 'sh')
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function getEnvUsageData() {
|
|
90
|
+
let os = 'unknown';
|
|
91
|
+
let browser = 'unknown';
|
|
92
|
+
if (env.isMac) {
|
|
93
|
+
os = 'mac';
|
|
94
|
+
}
|
|
95
|
+
else if (env.isWindows) {
|
|
96
|
+
os = 'windows';
|
|
97
|
+
}
|
|
98
|
+
else if (env.isiOS) {
|
|
99
|
+
os = 'ios';
|
|
100
|
+
}
|
|
101
|
+
else if (env.isAndroid) {
|
|
102
|
+
os = 'android';
|
|
103
|
+
}
|
|
104
|
+
if (env.isGecko) {
|
|
105
|
+
browser = 'gecko';
|
|
106
|
+
}
|
|
107
|
+
else if (env.isBlink) {
|
|
108
|
+
browser = 'blink';
|
|
109
|
+
}
|
|
110
|
+
else if (env.isSafari) {
|
|
111
|
+
browser = 'safari';
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
os,
|
|
115
|
+
browser
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function getSessionId() {
|
|
119
|
+
if (!localStorage.getItem('__ckeditor-session-id')) {
|
|
120
|
+
localStorage.setItem('__ckeditor-session-id', uid());
|
|
121
|
+
}
|
|
122
|
+
return localStorage.getItem('__ckeditor-session-id');
|
|
123
|
+
}
|
|
124
|
+
function getPageSessionID() {
|
|
125
|
+
global.window.CKEDITOR_PAGE_SESSION_ID = global.window.CKEDITOR_PAGE_SESSION_ID || uid();
|
|
126
|
+
return global.window.CKEDITOR_PAGE_SESSION_ID;
|
|
127
|
+
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -79,6 +79,9 @@ import html from './../theme/icons/html.svg';
|
|
|
79
79
|
import indent from './../theme/icons/indent.svg';
|
|
80
80
|
import outdent from './../theme/icons/outdent.svg';
|
|
81
81
|
import table from './../theme/icons/table.svg';
|
|
82
|
+
import remove from './../theme/icons/remove.svg';
|
|
83
|
+
import bookmark from './../theme/icons/bookmark.svg';
|
|
84
|
+
import bookmarkInline from './../theme/icons/bookmark_inline.svg';
|
|
82
85
|
export const icons = {
|
|
83
86
|
bold,
|
|
84
87
|
cancel,
|
|
@@ -142,6 +145,9 @@ export const icons = {
|
|
|
142
145
|
html,
|
|
143
146
|
indent,
|
|
144
147
|
outdent,
|
|
145
|
-
table
|
|
148
|
+
table,
|
|
149
|
+
remove,
|
|
150
|
+
bookmark,
|
|
151
|
+
bookmarkInline
|
|
146
152
|
};
|
|
147
153
|
import './augmentation.js';
|
package/src/plugincollection.js
CHANGED
|
@@ -279,7 +279,7 @@ export default class PluginCollection extends /* #__PURE__ */ EmitterMixin() {
|
|
|
279
279
|
* that you tried loading plugins by name. However, unlike CKEditor 4, CKEditor 5 does not implement a "plugin loader".
|
|
280
280
|
* This means that CKEditor 5 does not know where to load the plugin modules from. Therefore, you need to
|
|
281
281
|
* provide each plugin through a reference (as a constructor function). Check out the examples in the
|
|
282
|
-
* {@glink getting-started/installation/quick-start Quick start} guide.
|
|
282
|
+
* {@glink getting-started/installation/cloud/quick-start Quick start} guide.
|
|
283
283
|
*
|
|
284
284
|
* @error plugincollection-plugin-not-found
|
|
285
285
|
* @param plugin The name of the plugin which could not be loaded.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M5.68 3.417a.238.238 0 0 0-.24.236v12.66l3.793-3.102a1.215 1.215 0 0 1 1.534 0l3.793 3.103V3.654a.238.238 0 0 0-.24-.237H5.68ZM4 3.653C4 2.74 4.752 2 5.68 2h8.64c.928 0 1.68.74 1.68 1.653v13.164c0 1-1.185 1.547-1.967.908L10 14.426l-4.033 3.299c-.782.64-1.967.092-1.967-.908V3.653Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 14 16" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M2 14.436V2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v12.436a.5.5 0 0 1-.819.385l-3.862-3.2a.5.5 0 0 0-.638 0l-3.862 3.2A.5.5 0 0 1 2 14.436Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.2 7h9.2c.6 0 1 .4 1 1v9.9c0 .5-.4 1-1 1H5.2a1 1 0 0 1-1-1V8c0-.6.4-1 1-1Zm1 1.5c-.3 0-.5.2-.5.5v8c0 .3.2.5.5.5h.5c.2 0 .5-.2.5-.5V9c0-.3-.3-.5-.5-.5h-.5Zm3.2 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5h-.5Zm3.5 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5h-.5Zm-1.4-7.1H8.3L6.5 3.6H3.8c-.5 0-.7.3-.7.8s.2.7.7.7h12c.6 0 .9-.2.9-.7 0-.5-.3-.8-1-.8h-2.4l-1.8-2.2Z"/></svg>
|