@atlaskit/editor-core 189.4.10 → 189.4.12
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 +9 -0
- package/dist/cjs/composable-editor/editor-internal.js +3 -3
- package/dist/cjs/composable-editor/editor.js +202 -3
- package/dist/cjs/i18n/cs.js +1 -3
- package/dist/cjs/i18n/da.js +1 -3
- package/dist/cjs/i18n/de.js +1 -3
- package/dist/cjs/i18n/en.js +1 -3
- package/dist/cjs/i18n/en_GB.js +1 -3
- package/dist/cjs/i18n/en_ZZ.js +1 -3
- package/dist/cjs/i18n/es.js +1 -3
- package/dist/cjs/i18n/fi.js +1 -3
- package/dist/cjs/i18n/fr.js +1 -3
- package/dist/cjs/i18n/hu.js +1 -3
- package/dist/cjs/i18n/it.js +1 -3
- package/dist/cjs/i18n/ja.js +1 -3
- package/dist/cjs/i18n/ko.js +1 -3
- package/dist/cjs/i18n/nb.js +1 -3
- package/dist/cjs/i18n/nl.js +1 -3
- package/dist/cjs/i18n/pl.js +1 -3
- package/dist/cjs/i18n/pt_BR.js +1 -3
- package/dist/cjs/i18n/ru.js +1 -3
- package/dist/cjs/i18n/sv.js +1 -3
- package/dist/cjs/i18n/th.js +1 -3
- package/dist/cjs/i18n/tr.js +1 -3
- package/dist/cjs/i18n/uk.js +1 -3
- package/dist/cjs/i18n/vi.js +1 -3
- package/dist/cjs/i18n/zh.js +1 -3
- package/dist/cjs/i18n/zh_TW.js +1 -3
- package/dist/cjs/plugins/index.js +1 -15
- package/dist/cjs/presets/default.js +2 -2
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/editor-internal.js +4 -4
- package/dist/es2019/composable-editor/editor.js +208 -4
- package/dist/es2019/i18n/cs.js +1 -3
- package/dist/es2019/i18n/da.js +1 -3
- package/dist/es2019/i18n/de.js +1 -3
- package/dist/es2019/i18n/en.js +1 -3
- package/dist/es2019/i18n/en_GB.js +1 -3
- package/dist/es2019/i18n/en_ZZ.js +1 -3
- package/dist/es2019/i18n/es.js +1 -3
- package/dist/es2019/i18n/fi.js +1 -3
- package/dist/es2019/i18n/fr.js +1 -3
- package/dist/es2019/i18n/hu.js +1 -3
- package/dist/es2019/i18n/it.js +1 -3
- package/dist/es2019/i18n/ja.js +1 -3
- package/dist/es2019/i18n/ko.js +1 -3
- package/dist/es2019/i18n/nb.js +1 -3
- package/dist/es2019/i18n/nl.js +1 -3
- package/dist/es2019/i18n/pl.js +1 -3
- package/dist/es2019/i18n/pt_BR.js +1 -3
- package/dist/es2019/i18n/ru.js +1 -3
- package/dist/es2019/i18n/sv.js +1 -3
- package/dist/es2019/i18n/th.js +1 -3
- package/dist/es2019/i18n/tr.js +1 -3
- package/dist/es2019/i18n/uk.js +1 -3
- package/dist/es2019/i18n/vi.js +1 -3
- package/dist/es2019/i18n/zh.js +1 -3
- package/dist/es2019/i18n/zh_TW.js +1 -3
- package/dist/es2019/plugins/index.js +1 -3
- package/dist/es2019/presets/default.js +2 -2
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/editor-internal.js +3 -3
- package/dist/esm/composable-editor/editor.js +203 -4
- package/dist/esm/i18n/cs.js +1 -3
- package/dist/esm/i18n/da.js +1 -3
- package/dist/esm/i18n/de.js +1 -3
- package/dist/esm/i18n/en.js +1 -3
- package/dist/esm/i18n/en_GB.js +1 -3
- package/dist/esm/i18n/en_ZZ.js +1 -3
- package/dist/esm/i18n/es.js +1 -3
- package/dist/esm/i18n/fi.js +1 -3
- package/dist/esm/i18n/fr.js +1 -3
- package/dist/esm/i18n/hu.js +1 -3
- package/dist/esm/i18n/it.js +1 -3
- package/dist/esm/i18n/ja.js +1 -3
- package/dist/esm/i18n/ko.js +1 -3
- package/dist/esm/i18n/nb.js +1 -3
- package/dist/esm/i18n/nl.js +1 -3
- package/dist/esm/i18n/pl.js +1 -3
- package/dist/esm/i18n/pt_BR.js +1 -3
- package/dist/esm/i18n/ru.js +1 -3
- package/dist/esm/i18n/sv.js +1 -3
- package/dist/esm/i18n/th.js +1 -3
- package/dist/esm/i18n/tr.js +1 -3
- package/dist/esm/i18n/uk.js +1 -3
- package/dist/esm/i18n/vi.js +1 -3
- package/dist/esm/i18n/zh.js +1 -3
- package/dist/esm/i18n/zh_TW.js +1 -3
- package/dist/esm/plugins/index.js +1 -3
- package/dist/esm/presets/default.js +2 -2
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/editor-internal.d.ts +2 -1
- package/dist/types/i18n/cs.d.ts +0 -2
- package/dist/types/i18n/da.d.ts +0 -2
- package/dist/types/i18n/de.d.ts +0 -2
- package/dist/types/i18n/en.d.ts +0 -2
- package/dist/types/i18n/en_GB.d.ts +0 -2
- package/dist/types/i18n/en_ZZ.d.ts +0 -2
- package/dist/types/i18n/es.d.ts +0 -2
- package/dist/types/i18n/fi.d.ts +0 -2
- package/dist/types/i18n/fr.d.ts +0 -2
- package/dist/types/i18n/hu.d.ts +0 -2
- package/dist/types/i18n/it.d.ts +0 -2
- package/dist/types/i18n/ja.d.ts +0 -2
- package/dist/types/i18n/ko.d.ts +0 -2
- package/dist/types/i18n/nb.d.ts +0 -2
- package/dist/types/i18n/nl.d.ts +0 -2
- package/dist/types/i18n/pl.d.ts +0 -2
- package/dist/types/i18n/pt_BR.d.ts +0 -2
- package/dist/types/i18n/ru.d.ts +0 -2
- package/dist/types/i18n/sv.d.ts +0 -2
- package/dist/types/i18n/th.d.ts +0 -2
- package/dist/types/i18n/tr.d.ts +0 -2
- package/dist/types/i18n/uk.d.ts +0 -2
- package/dist/types/i18n/vi.d.ts +0 -2
- package/dist/types/i18n/zh.d.ts +0 -2
- package/dist/types/i18n/zh_TW.d.ts +0 -2
- package/dist/types/plugins/index.d.ts +0 -2
- package/dist/types-ts4.5/composable-editor/editor-internal.d.ts +2 -1
- package/dist/types-ts4.5/i18n/cs.d.ts +0 -2
- package/dist/types-ts4.5/i18n/da.d.ts +0 -2
- package/dist/types-ts4.5/i18n/de.d.ts +0 -2
- package/dist/types-ts4.5/i18n/en.d.ts +0 -2
- package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -2
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -2
- package/dist/types-ts4.5/i18n/es.d.ts +0 -2
- package/dist/types-ts4.5/i18n/fi.d.ts +0 -2
- package/dist/types-ts4.5/i18n/fr.d.ts +0 -2
- package/dist/types-ts4.5/i18n/hu.d.ts +0 -2
- package/dist/types-ts4.5/i18n/it.d.ts +0 -2
- package/dist/types-ts4.5/i18n/ja.d.ts +0 -2
- package/dist/types-ts4.5/i18n/ko.d.ts +0 -2
- package/dist/types-ts4.5/i18n/nb.d.ts +0 -2
- package/dist/types-ts4.5/i18n/nl.d.ts +0 -2
- package/dist/types-ts4.5/i18n/pl.d.ts +0 -2
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -2
- package/dist/types-ts4.5/i18n/ru.d.ts +0 -2
- package/dist/types-ts4.5/i18n/sv.d.ts +0 -2
- package/dist/types-ts4.5/i18n/th.d.ts +0 -2
- package/dist/types-ts4.5/i18n/tr.d.ts +0 -2
- package/dist/types-ts4.5/i18n/uk.d.ts +0 -2
- package/dist/types-ts4.5/i18n/vi.d.ts +0 -2
- package/dist/types-ts4.5/i18n/zh.d.ts +0 -2
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -2
- package/package.json +10 -6
- package/dist/cjs/plugins/clear-marks-on-change-to-empty-document/index.js +0 -35
- package/dist/cjs/plugins/code-bidi-warning/index.js +0 -22
- package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +0 -8
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +0 -44
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +0 -105
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +0 -9
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +0 -5
- package/dist/es2019/plugins/clear-marks-on-change-to-empty-document/index.js +0 -26
- package/dist/es2019/plugins/code-bidi-warning/index.js +0 -15
- package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +0 -2
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +0 -41
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +0 -97
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +0 -3
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +0 -1
- package/dist/esm/plugins/clear-marks-on-change-to-empty-document/index.js +0 -28
- package/dist/esm/plugins/code-bidi-warning/index.js +0 -16
- package/dist/esm/plugins/code-bidi-warning/plugin-key.js +0 -2
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +0 -38
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +0 -98
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +0 -3
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +0 -1
- package/dist/types/plugins/clear-marks-on-change-to-empty-document/index.d.ts +0 -7
- package/dist/types/plugins/code-bidi-warning/index.d.ts +0 -8
- package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +0 -2
- package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +0 -5
- package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +0 -8
- package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +0 -3
- package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +0 -6
- package/dist/types-ts4.5/plugins/clear-marks-on-change-to-empty-document/index.d.ts +0 -7
- package/dist/types-ts4.5/plugins/code-bidi-warning/index.d.ts +0 -8
- package/dist/types-ts4.5/plugins/code-bidi-warning/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/main.d.ts +0 -5
- package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +0 -8
- package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +0 -3
- package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/types.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "189.4.
|
|
3
|
+
"version": "189.4.12",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -49,10 +49,9 @@
|
|
|
49
49
|
"@atlaskit/avatar-group": "^9.4.0",
|
|
50
50
|
"@atlaskit/button": "^16.17.0",
|
|
51
51
|
"@atlaskit/checkbox": "^13.0.0",
|
|
52
|
-
"@atlaskit/code": "^15.1.0",
|
|
53
52
|
"@atlaskit/date": "^0.10.0",
|
|
54
53
|
"@atlaskit/datetime-picker": "^13.0.0",
|
|
55
|
-
"@atlaskit/editor-common": "^76.
|
|
54
|
+
"@atlaskit/editor-common": "^76.24.0",
|
|
56
55
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
57
56
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
58
57
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
@@ -62,7 +61,9 @@
|
|
|
62
61
|
"@atlaskit/editor-plugin-border": "^0.1.0",
|
|
63
62
|
"@atlaskit/editor-plugin-caption": "^0.2.0",
|
|
64
63
|
"@atlaskit/editor-plugin-card": "^0.14.0",
|
|
64
|
+
"@atlaskit/editor-plugin-clear-marks-on-empty-doc": "^0.1.0",
|
|
65
65
|
"@atlaskit/editor-plugin-clipboard": "^0.1.0",
|
|
66
|
+
"@atlaskit/editor-plugin-code-bidi-warning": "^0.1.0",
|
|
66
67
|
"@atlaskit/editor-plugin-code-block": "^0.1.0",
|
|
67
68
|
"@atlaskit/editor-plugin-composition": "^0.1.0",
|
|
68
69
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.4",
|
|
@@ -168,12 +169,12 @@
|
|
|
168
169
|
"@af/integration-testing": "*",
|
|
169
170
|
"@af/visual-regression": "*",
|
|
170
171
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
171
|
-
"@atlaskit/
|
|
172
|
+
"@atlaskit/code": "^15.1.0",
|
|
173
|
+
"@atlaskit/collab-provider": "9.17.5",
|
|
172
174
|
"@atlaskit/dropdown-menu": "^12.1.0",
|
|
173
175
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
174
176
|
"@atlaskit/editor-palette": "1.5.2",
|
|
175
177
|
"@atlaskit/flag": "^15.2.0",
|
|
176
|
-
"@atlaskit/icon-object": "^6.3.0",
|
|
177
178
|
"@atlaskit/inline-dialog": "^14.0.0",
|
|
178
179
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
179
180
|
"@atlaskit/link-provider": "^1.6.0",
|
|
@@ -190,7 +191,7 @@
|
|
|
190
191
|
"@atlaskit/webdriver-runner": "*",
|
|
191
192
|
"@atlassian/adf-schema-json": "^1.0.7",
|
|
192
193
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
193
|
-
"@atlassian/editor-extension-link-create": "^0.
|
|
194
|
+
"@atlassian/editor-extension-link-create": "^0.10.0",
|
|
194
195
|
"@atlassian/feature-flags-test-utils": "^0.1.1",
|
|
195
196
|
"@atlassian/link-picker-plugins": "^24.0.0",
|
|
196
197
|
"@atlassian/search-provider": "2.4.8",
|
|
@@ -239,6 +240,9 @@
|
|
|
239
240
|
},
|
|
240
241
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
241
242
|
"platform-feature-flags": {
|
|
243
|
+
"platform.editor.less-editor-props-rerendering": {
|
|
244
|
+
"type": "boolean"
|
|
245
|
+
},
|
|
242
246
|
"platform.editor.custom-table-width": {
|
|
243
247
|
"type": "boolean"
|
|
244
248
|
},
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createPlugin = createPlugin;
|
|
7
|
-
exports.pluginKey = exports.default = void 0;
|
|
8
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
|
-
var pluginKey = exports.pluginKey = new _state.PluginKey('clearMarksOnChangeToEmptyDocumentPlugin');
|
|
12
|
-
function createPlugin() {
|
|
13
|
-
return new _safePlugin.SafePlugin({
|
|
14
|
-
key: pluginKey,
|
|
15
|
-
appendTransaction: function appendTransaction(_transactions, oldState, newState) {
|
|
16
|
-
// ED-2973: When a user clears the editor's content, remove the current active marks
|
|
17
|
-
if (!(0, _utils.isEmptyDocument)(oldState.doc) && (0, _utils.isEmptyDocument)(newState.doc)) {
|
|
18
|
-
return newState.tr.setStoredMarks([]);
|
|
19
|
-
}
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
var clearMarksOnChangeToEmptyDocumentPlugin = function clearMarksOnChangeToEmptyDocumentPlugin() {
|
|
25
|
-
return {
|
|
26
|
-
name: 'clearMarksOnEmptyDoc',
|
|
27
|
-
pmPlugins: function pmPlugins() {
|
|
28
|
-
return [{
|
|
29
|
-
name: 'clearMarksOnChange',
|
|
30
|
-
plugin: createPlugin
|
|
31
|
-
}];
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
var _default = exports.default = clearMarksOnChangeToEmptyDocumentPlugin;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _main = require("./pm-plugins/main");
|
|
8
|
-
var codeBidiWarning = function codeBidiWarning(_ref) {
|
|
9
|
-
var config = _ref.config;
|
|
10
|
-
return {
|
|
11
|
-
name: 'codeBidiWarning',
|
|
12
|
-
pmPlugins: function pmPlugins() {
|
|
13
|
-
return [{
|
|
14
|
-
name: 'codeBidiWarning',
|
|
15
|
-
plugin: function plugin(options) {
|
|
16
|
-
return (0, _main.createPlugin)(options, config);
|
|
17
|
-
}
|
|
18
|
-
}];
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
var _default = exports.default = codeBidiWarning;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.codeBidiWarningPluginKey = void 0;
|
|
7
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var codeBidiWarningPluginKey = exports.codeBidiWarningPluginKey = new _state.PluginKey('codeBidiWarningPlugin');
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createPlugin = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
9
|
-
var _pluginKey = require("../plugin-key");
|
|
10
|
-
var _pluginFactory = require("./plugin-factory");
|
|
11
|
-
var createPlugin = exports.createPlugin = function createPlugin(_ref, _ref2) {
|
|
12
|
-
var dispatch = _ref.dispatch,
|
|
13
|
-
getIntl = _ref.getIntl;
|
|
14
|
-
var appearance = _ref2.appearance;
|
|
15
|
-
var intl = getIntl();
|
|
16
|
-
var codeBidiWarningLabel = intl.formatMessage(_messages.codeBidiWarningMessages.label);
|
|
17
|
-
return new _safePlugin.SafePlugin({
|
|
18
|
-
key: _pluginKey.codeBidiWarningPluginKey,
|
|
19
|
-
state: (0, _pluginFactory.createPluginState)(dispatch, function (state) {
|
|
20
|
-
// The appearance being mobile indicates we are in an editor being
|
|
21
|
-
// rendered by mobile bridge in a web view.
|
|
22
|
-
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
23
|
-
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
24
|
-
// the rendering in the mobile Native Renderer.
|
|
25
|
-
var tooltipEnabled = appearance !== 'mobile';
|
|
26
|
-
return {
|
|
27
|
-
decorationSet: (0, _pluginFactory.createBidiWarningsDecorationSetFromDoc)({
|
|
28
|
-
doc: state.doc,
|
|
29
|
-
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
30
|
-
tooltipEnabled: tooltipEnabled
|
|
31
|
-
}),
|
|
32
|
-
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
33
|
-
tooltipEnabled: tooltipEnabled
|
|
34
|
-
};
|
|
35
|
-
}),
|
|
36
|
-
props: {
|
|
37
|
-
decorations: function decorations(state) {
|
|
38
|
-
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
39
|
-
decorationSet = _getPluginState.decorationSet;
|
|
40
|
-
return decorationSet;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createBidiWarningsDecorationSetFromDoc = createBidiWarningsDecorationSetFromDoc;
|
|
8
|
-
exports.getPluginState = exports.createPluginState = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
12
|
-
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
13
|
-
var _bidiWarning = _interopRequireDefault(require("@atlaskit/code/bidi-warning"));
|
|
14
|
-
var _bidiWarningDecorator = _interopRequireDefault(require("@atlaskit/code/bidi-warning-decorator"));
|
|
15
|
-
var _pluginStateFactory = require("../../../utils/plugin-state-factory");
|
|
16
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
|
-
var _pluginKey = require("../plugin-key");
|
|
18
|
-
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
19
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
-
var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(_pluginKey.codeBidiWarningPluginKey, _reducer.default, {
|
|
22
|
-
onDocChanged: function onDocChanged(tr, pluginState) {
|
|
23
|
-
if (!tr.steps.find(_utils.stepHasSlice)) {
|
|
24
|
-
return pluginState;
|
|
25
|
-
}
|
|
26
|
-
var newBidiWarningsDecorationSet = createBidiWarningsDecorationSetFromDoc({
|
|
27
|
-
doc: tr.doc,
|
|
28
|
-
codeBidiWarningLabel: pluginState.codeBidiWarningLabel,
|
|
29
|
-
tooltipEnabled: pluginState.tooltipEnabled
|
|
30
|
-
});
|
|
31
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
32
|
-
decorationSet: newBidiWarningsDecorationSet
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
createPluginState = exports.createPluginState = _pluginFactory.createPluginState,
|
|
37
|
-
getPluginState = exports.getPluginState = _pluginFactory.getPluginState;
|
|
38
|
-
function createBidiWarningsDecorationSetFromDoc(_ref) {
|
|
39
|
-
var doc = _ref.doc,
|
|
40
|
-
codeBidiWarningLabel = _ref.codeBidiWarningLabel,
|
|
41
|
-
tooltipEnabled = _ref.tooltipEnabled;
|
|
42
|
-
var bidiCharactersAndTheirPositions = [];
|
|
43
|
-
doc.descendants(function (node, pos) {
|
|
44
|
-
var isTextWithCodeMark = node.type.name === 'text' && node.marks && node.marks.some(function (mark) {
|
|
45
|
-
return mark.type.name === 'code';
|
|
46
|
-
});
|
|
47
|
-
if (isTextWithCodeMark) {
|
|
48
|
-
(0, _bidiWarningDecorator.default)(node.textContent, function (_ref2) {
|
|
49
|
-
var bidiCharacter = _ref2.bidiCharacter,
|
|
50
|
-
index = _ref2.index;
|
|
51
|
-
bidiCharactersAndTheirPositions.push({
|
|
52
|
-
position: pos + index,
|
|
53
|
-
bidiCharacter: bidiCharacter
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
var isCodeBlock = node.type.name === 'codeBlock';
|
|
59
|
-
if (isCodeBlock) {
|
|
60
|
-
(0, _bidiWarningDecorator.default)(node.textContent, function (_ref3) {
|
|
61
|
-
var bidiCharacter = _ref3.bidiCharacter,
|
|
62
|
-
index = _ref3.index;
|
|
63
|
-
bidiCharactersAndTheirPositions.push({
|
|
64
|
-
position: pos + index + 1,
|
|
65
|
-
bidiCharacter: bidiCharacter
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// Bidi characters are not expected to commonly appear in code snippets, so recreating the decoration set
|
|
72
|
-
// for documents rather than reusing existing decorations seems a reasonable performance/complexity tradeoff.
|
|
73
|
-
|
|
74
|
-
if (bidiCharactersAndTheirPositions.length === 0) {
|
|
75
|
-
return _view.DecorationSet.empty;
|
|
76
|
-
}
|
|
77
|
-
var newBidiWarningsDecorationSet = _view.DecorationSet.create(doc, bidiCharactersAndTheirPositions.map(function (_ref4) {
|
|
78
|
-
var position = _ref4.position,
|
|
79
|
-
bidiCharacter = _ref4.bidiCharacter;
|
|
80
|
-
return _view.Decoration.widget(position, function () {
|
|
81
|
-
return renderDOM({
|
|
82
|
-
bidiCharacter: bidiCharacter,
|
|
83
|
-
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
84
|
-
tooltipEnabled: tooltipEnabled
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}));
|
|
88
|
-
return newBidiWarningsDecorationSet;
|
|
89
|
-
}
|
|
90
|
-
function renderDOM(_ref5) {
|
|
91
|
-
var bidiCharacter = _ref5.bidiCharacter,
|
|
92
|
-
codeBidiWarningLabel = _ref5.codeBidiWarningLabel,
|
|
93
|
-
tooltipEnabled = _ref5.tooltipEnabled;
|
|
94
|
-
var element = document.createElement('span');
|
|
95
|
-
|
|
96
|
-
// Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
|
|
97
|
-
// we should investigate if there is a memory leak with such usage.
|
|
98
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_bidiWarning.default, {
|
|
99
|
-
bidiCharacter: bidiCharacter,
|
|
100
|
-
skipChildren: true,
|
|
101
|
-
label: codeBidiWarningLabel,
|
|
102
|
-
tooltipEnabled: tooltipEnabled
|
|
103
|
-
}), element);
|
|
104
|
-
return element;
|
|
105
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export const pluginKey = new PluginKey('clearMarksOnChangeToEmptyDocumentPlugin');
|
|
5
|
-
export function createPlugin() {
|
|
6
|
-
return new SafePlugin({
|
|
7
|
-
key: pluginKey,
|
|
8
|
-
appendTransaction: (_transactions, oldState, newState) => {
|
|
9
|
-
// ED-2973: When a user clears the editor's content, remove the current active marks
|
|
10
|
-
if (!isEmptyDocument(oldState.doc) && isEmptyDocument(newState.doc)) {
|
|
11
|
-
return newState.tr.setStoredMarks([]);
|
|
12
|
-
}
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const clearMarksOnChangeToEmptyDocumentPlugin = () => ({
|
|
18
|
-
name: 'clearMarksOnEmptyDoc',
|
|
19
|
-
pmPlugins() {
|
|
20
|
-
return [{
|
|
21
|
-
name: 'clearMarksOnChange',
|
|
22
|
-
plugin: createPlugin
|
|
23
|
-
}];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
export default clearMarksOnChangeToEmptyDocumentPlugin;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createPlugin } from './pm-plugins/main';
|
|
2
|
-
const codeBidiWarning = ({
|
|
3
|
-
config
|
|
4
|
-
}) => ({
|
|
5
|
-
name: 'codeBidiWarning',
|
|
6
|
-
pmPlugins() {
|
|
7
|
-
return [{
|
|
8
|
-
name: 'codeBidiWarning',
|
|
9
|
-
plugin: options => {
|
|
10
|
-
return createPlugin(options, config);
|
|
11
|
-
}
|
|
12
|
-
}];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export default codeBidiWarning;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
3
|
-
import { codeBidiWarningPluginKey } from '../plugin-key';
|
|
4
|
-
import { createBidiWarningsDecorationSetFromDoc, createPluginState, getPluginState } from './plugin-factory';
|
|
5
|
-
export const createPlugin = ({
|
|
6
|
-
dispatch,
|
|
7
|
-
getIntl
|
|
8
|
-
}, {
|
|
9
|
-
appearance
|
|
10
|
-
}) => {
|
|
11
|
-
const intl = getIntl();
|
|
12
|
-
const codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
|
|
13
|
-
return new SafePlugin({
|
|
14
|
-
key: codeBidiWarningPluginKey,
|
|
15
|
-
state: createPluginState(dispatch, state => {
|
|
16
|
-
// The appearance being mobile indicates we are in an editor being
|
|
17
|
-
// rendered by mobile bridge in a web view.
|
|
18
|
-
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
19
|
-
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
20
|
-
// the rendering in the mobile Native Renderer.
|
|
21
|
-
const tooltipEnabled = appearance !== 'mobile';
|
|
22
|
-
return {
|
|
23
|
-
decorationSet: createBidiWarningsDecorationSetFromDoc({
|
|
24
|
-
doc: state.doc,
|
|
25
|
-
codeBidiWarningLabel,
|
|
26
|
-
tooltipEnabled
|
|
27
|
-
}),
|
|
28
|
-
codeBidiWarningLabel,
|
|
29
|
-
tooltipEnabled
|
|
30
|
-
};
|
|
31
|
-
}),
|
|
32
|
-
props: {
|
|
33
|
-
decorations: state => {
|
|
34
|
-
const {
|
|
35
|
-
decorationSet
|
|
36
|
-
} = getPluginState(state);
|
|
37
|
-
return decorationSet;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import CodeBidiWarning from '@atlaskit/code/bidi-warning';
|
|
5
|
-
import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
|
|
6
|
-
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
7
|
-
import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { codeBidiWarningPluginKey } from '../plugin-key';
|
|
9
|
-
import reducer from './reducer';
|
|
10
|
-
export const {
|
|
11
|
-
createPluginState,
|
|
12
|
-
getPluginState
|
|
13
|
-
} = pluginFactory(codeBidiWarningPluginKey, reducer, {
|
|
14
|
-
onDocChanged: (tr, pluginState) => {
|
|
15
|
-
if (!tr.steps.find(stepHasSlice)) {
|
|
16
|
-
return pluginState;
|
|
17
|
-
}
|
|
18
|
-
const newBidiWarningsDecorationSet = createBidiWarningsDecorationSetFromDoc({
|
|
19
|
-
doc: tr.doc,
|
|
20
|
-
codeBidiWarningLabel: pluginState.codeBidiWarningLabel,
|
|
21
|
-
tooltipEnabled: pluginState.tooltipEnabled
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
...pluginState,
|
|
25
|
-
decorationSet: newBidiWarningsDecorationSet
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
export function createBidiWarningsDecorationSetFromDoc({
|
|
30
|
-
doc,
|
|
31
|
-
codeBidiWarningLabel,
|
|
32
|
-
tooltipEnabled
|
|
33
|
-
}) {
|
|
34
|
-
const bidiCharactersAndTheirPositions = [];
|
|
35
|
-
doc.descendants((node, pos) => {
|
|
36
|
-
const isTextWithCodeMark = node.type.name === 'text' && node.marks && node.marks.some(mark => mark.type.name === 'code');
|
|
37
|
-
if (isTextWithCodeMark) {
|
|
38
|
-
codeBidiWarningDecorator(node.textContent, ({
|
|
39
|
-
bidiCharacter,
|
|
40
|
-
index
|
|
41
|
-
}) => {
|
|
42
|
-
bidiCharactersAndTheirPositions.push({
|
|
43
|
-
position: pos + index,
|
|
44
|
-
bidiCharacter
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
const isCodeBlock = node.type.name === 'codeBlock';
|
|
50
|
-
if (isCodeBlock) {
|
|
51
|
-
codeBidiWarningDecorator(node.textContent, ({
|
|
52
|
-
bidiCharacter,
|
|
53
|
-
index
|
|
54
|
-
}) => {
|
|
55
|
-
bidiCharactersAndTheirPositions.push({
|
|
56
|
-
position: pos + index + 1,
|
|
57
|
-
bidiCharacter
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Bidi characters are not expected to commonly appear in code snippets, so recreating the decoration set
|
|
64
|
-
// for documents rather than reusing existing decorations seems a reasonable performance/complexity tradeoff.
|
|
65
|
-
|
|
66
|
-
if (bidiCharactersAndTheirPositions.length === 0) {
|
|
67
|
-
return DecorationSet.empty;
|
|
68
|
-
}
|
|
69
|
-
const newBidiWarningsDecorationSet = DecorationSet.create(doc, bidiCharactersAndTheirPositions.map(({
|
|
70
|
-
position,
|
|
71
|
-
bidiCharacter
|
|
72
|
-
}) => {
|
|
73
|
-
return Decoration.widget(position, () => renderDOM({
|
|
74
|
-
bidiCharacter,
|
|
75
|
-
codeBidiWarningLabel,
|
|
76
|
-
tooltipEnabled
|
|
77
|
-
}));
|
|
78
|
-
}));
|
|
79
|
-
return newBidiWarningsDecorationSet;
|
|
80
|
-
}
|
|
81
|
-
function renderDOM({
|
|
82
|
-
bidiCharacter,
|
|
83
|
-
codeBidiWarningLabel,
|
|
84
|
-
tooltipEnabled
|
|
85
|
-
}) {
|
|
86
|
-
const element = document.createElement('span');
|
|
87
|
-
|
|
88
|
-
// Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
|
|
89
|
-
// we should investigate if there is a memory leak with such usage.
|
|
90
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(CodeBidiWarning, {
|
|
91
|
-
bidiCharacter: bidiCharacter,
|
|
92
|
-
skipChildren: true,
|
|
93
|
-
label: codeBidiWarningLabel,
|
|
94
|
-
tooltipEnabled: tooltipEnabled
|
|
95
|
-
}), element);
|
|
96
|
-
return element;
|
|
97
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export var pluginKey = new PluginKey('clearMarksOnChangeToEmptyDocumentPlugin');
|
|
5
|
-
export function createPlugin() {
|
|
6
|
-
return new SafePlugin({
|
|
7
|
-
key: pluginKey,
|
|
8
|
-
appendTransaction: function appendTransaction(_transactions, oldState, newState) {
|
|
9
|
-
// ED-2973: When a user clears the editor's content, remove the current active marks
|
|
10
|
-
if (!isEmptyDocument(oldState.doc) && isEmptyDocument(newState.doc)) {
|
|
11
|
-
return newState.tr.setStoredMarks([]);
|
|
12
|
-
}
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
var clearMarksOnChangeToEmptyDocumentPlugin = function clearMarksOnChangeToEmptyDocumentPlugin() {
|
|
18
|
-
return {
|
|
19
|
-
name: 'clearMarksOnEmptyDoc',
|
|
20
|
-
pmPlugins: function pmPlugins() {
|
|
21
|
-
return [{
|
|
22
|
-
name: 'clearMarksOnChange',
|
|
23
|
-
plugin: createPlugin
|
|
24
|
-
}];
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export default clearMarksOnChangeToEmptyDocumentPlugin;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createPlugin } from './pm-plugins/main';
|
|
2
|
-
var codeBidiWarning = function codeBidiWarning(_ref) {
|
|
3
|
-
var config = _ref.config;
|
|
4
|
-
return {
|
|
5
|
-
name: 'codeBidiWarning',
|
|
6
|
-
pmPlugins: function pmPlugins() {
|
|
7
|
-
return [{
|
|
8
|
-
name: 'codeBidiWarning',
|
|
9
|
-
plugin: function plugin(options) {
|
|
10
|
-
return createPlugin(options, config);
|
|
11
|
-
}
|
|
12
|
-
}];
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export default codeBidiWarning;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
3
|
-
import { codeBidiWarningPluginKey } from '../plugin-key';
|
|
4
|
-
import { createBidiWarningsDecorationSetFromDoc, createPluginState, getPluginState } from './plugin-factory';
|
|
5
|
-
export var createPlugin = function createPlugin(_ref, _ref2) {
|
|
6
|
-
var dispatch = _ref.dispatch,
|
|
7
|
-
getIntl = _ref.getIntl;
|
|
8
|
-
var appearance = _ref2.appearance;
|
|
9
|
-
var intl = getIntl();
|
|
10
|
-
var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
|
|
11
|
-
return new SafePlugin({
|
|
12
|
-
key: codeBidiWarningPluginKey,
|
|
13
|
-
state: createPluginState(dispatch, function (state) {
|
|
14
|
-
// The appearance being mobile indicates we are in an editor being
|
|
15
|
-
// rendered by mobile bridge in a web view.
|
|
16
|
-
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
17
|
-
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
18
|
-
// the rendering in the mobile Native Renderer.
|
|
19
|
-
var tooltipEnabled = appearance !== 'mobile';
|
|
20
|
-
return {
|
|
21
|
-
decorationSet: createBidiWarningsDecorationSetFromDoc({
|
|
22
|
-
doc: state.doc,
|
|
23
|
-
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
24
|
-
tooltipEnabled: tooltipEnabled
|
|
25
|
-
}),
|
|
26
|
-
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
27
|
-
tooltipEnabled: tooltipEnabled
|
|
28
|
-
};
|
|
29
|
-
}),
|
|
30
|
-
props: {
|
|
31
|
-
decorations: function decorations(state) {
|
|
32
|
-
var _getPluginState = getPluginState(state),
|
|
33
|
-
decorationSet = _getPluginState.decorationSet;
|
|
34
|
-
return decorationSet;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|