@atlaskit/editor-core 189.0.14 → 189.1.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/CHANGELOG.md +18 -0
- package/dist/cjs/extensibility.js +4 -4
- package/dist/cjs/plugins/annotation/commands/index.js +51 -43
- package/dist/cjs/plugins/annotation/commands/transform.js +43 -33
- package/dist/cjs/plugins/annotation/index.js +12 -5
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +17 -13
- package/dist/cjs/plugins/annotation/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/annotation/toolbar.js +41 -39
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +4 -3
- package/dist/cjs/plugins/index.js +0 -14
- package/dist/cjs/plugins/placeholder-text/index.js +8 -1
- package/dist/cjs/plugins/placeholder-text/plugin.js +2 -1
- package/dist/cjs/plugins/placeholder-text/styles.js +1 -1
- package/dist/cjs/presets/default.js +1 -2
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/ui/ContentStyles/index.js +7 -8
- package/dist/cjs/utils/document.js +0 -26
- package/dist/cjs/utils/index.js +0 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/extensibility.js +1 -1
- package/dist/es2019/plugins/annotation/commands/index.js +8 -8
- package/dist/es2019/plugins/annotation/commands/transform.js +13 -11
- package/dist/es2019/plugins/annotation/index.js +12 -5
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +10 -10
- package/dist/es2019/plugins/annotation/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/annotation/toolbar.js +2 -2
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +4 -3
- package/dist/es2019/plugins/index.js +0 -2
- package/dist/es2019/plugins/placeholder-text/index.js +2 -1
- package/dist/es2019/plugins/placeholder-text/plugin.js +2 -1
- package/dist/es2019/plugins/placeholder-text/styles.js +24 -1
- package/dist/es2019/presets/default.js +1 -2
- package/dist/es2019/presets/universal.js +3 -2
- package/dist/es2019/ui/ContentStyles/index.js +0 -2
- package/dist/es2019/utils/document.js +0 -25
- package/dist/es2019/utils/index.js +0 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/extensibility.js +1 -1
- package/dist/esm/plugins/annotation/commands/index.js +51 -43
- package/dist/esm/plugins/annotation/commands/transform.js +40 -30
- package/dist/esm/plugins/annotation/index.js +12 -5
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +17 -13
- package/dist/esm/plugins/annotation/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/annotation/toolbar.js +41 -39
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +4 -3
- package/dist/esm/plugins/index.js +0 -2
- package/dist/esm/plugins/placeholder-text/index.js +2 -1
- package/dist/esm/plugins/placeholder-text/plugin.js +2 -1
- package/dist/esm/plugins/placeholder-text/styles.js +2 -2
- package/dist/esm/presets/default.js +1 -2
- package/dist/esm/presets/universal.js +3 -2
- package/dist/esm/ui/ContentStyles/index.js +2 -3
- package/dist/esm/utils/document.js +0 -24
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/extensibility.d.ts +1 -1
- package/dist/types/plugins/annotation/commands/index.d.ts +5 -4
- package/dist/types/plugins/annotation/commands/transform.d.ts +5 -4
- package/dist/types/plugins/annotation/index.d.ts +5 -2
- package/dist/types/plugins/annotation/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +2 -0
- package/dist/types/plugins/annotation/toolbar.d.ts +2 -1
- package/dist/types/plugins/annotation/ui/InlineCommentView.d.ts +3 -1
- package/dist/types/plugins/index.d.ts +0 -2
- package/dist/types/plugins/placeholder-text/index.d.ts +1 -0
- package/dist/types/plugins/placeholder-text/types.d.ts +4 -1
- package/dist/types/presets/default.d.ts +4 -4
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/document.d.ts +0 -11
- package/dist/types-ts4.5/extensibility.d.ts +1 -1
- package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +5 -4
- package/dist/types-ts4.5/plugins/annotation/commands/transform.d.ts +5 -4
- package/dist/types-ts4.5/plugins/annotation/index.d.ts +7 -2
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/ui/InlineCommentView.d.ts +3 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/placeholder-text/types.d.ts +1 -1
- package/dist/types-ts4.5/presets/default.d.ts +0 -4
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/document.d.ts +0 -11
- package/package.json +4 -3
- package/dist/cjs/plugins/fake-text-cursor/index.js +0 -32
- package/dist/cjs/plugins/fake-text-cursor/styles.js +0 -12
- package/dist/cjs/plugins/fragment/index.js +0 -29
- package/dist/cjs/plugins/fragment/plugin-key.js +0 -8
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +0 -143
- package/dist/es2019/plugins/fake-text-cursor/index.js +0 -20
- package/dist/es2019/plugins/fake-text-cursor/styles.js +0 -26
- package/dist/es2019/plugins/fragment/index.js +0 -20
- package/dist/es2019/plugins/fragment/plugin-key.js +0 -2
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +0 -113
- package/dist/esm/plugins/fake-text-cursor/index.js +0 -26
- package/dist/esm/plugins/fake-text-cursor/styles.js +0 -5
- package/dist/esm/plugins/fragment/index.js +0 -23
- package/dist/esm/plugins/fragment/plugin-key.js +0 -2
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +0 -137
- package/dist/types/plugins/fake-text-cursor/index.d.ts +0 -7
- package/dist/types/plugins/fake-text-cursor/styles.d.ts +0 -1
- package/dist/types/plugins/fragment/index.d.ts +0 -3
- package/dist/types/plugins/fragment/plugin-key.d.ts +0 -2
- package/dist/types/plugins/fragment/pm-plugins/fragment-consistency.d.ts +0 -15
- package/dist/types-ts4.5/plugins/fake-text-cursor/index.d.ts +0 -7
- package/dist/types-ts4.5/plugins/fake-text-cursor/styles.d.ts +0 -1
- package/dist/types-ts4.5/plugins/fragment/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/fragment/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/fragment/pm-plugins/fragment-consistency.d.ts +0 -15
- /package/dist/cjs/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.js +0 -0
- /package/dist/es2019/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.js +0 -0
- /package/dist/esm/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.js +0 -0
- /package/dist/types/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.d.ts +0 -0
- /package/dist/types-ts4.5/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.d.ts +0 -0
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This plugin ensures that certain nodes (such as tables, and various extension ones)
|
|
3
|
-
* have a unique `localId` attribute value for `fragment` marks.
|
|
4
|
-
* It also ensures the preservation of these IDs when nodes are being cut-and-pasted
|
|
5
|
-
* around the document.
|
|
6
|
-
*
|
|
7
|
-
* The implementation has been _heavily_ borrowed from
|
|
8
|
-
* - packages/editor/editor-core/src/plugins/table/pm-plugins/table-local-id.ts
|
|
9
|
-
*/
|
|
10
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
-
import { uuid } from '@atlaskit/adf-schema';
|
|
13
|
-
import { getChangedNodes } from '../../../utils/document';
|
|
14
|
-
const pluginKey = new PluginKey('fragmentMarkConsistencyPlugin');
|
|
15
|
-
const getNodesSupportingFragmentMark = schema => {
|
|
16
|
-
const {
|
|
17
|
-
table,
|
|
18
|
-
extension,
|
|
19
|
-
bodiedExtension,
|
|
20
|
-
inlineExtension
|
|
21
|
-
} = schema.nodes;
|
|
22
|
-
return [table, extension, bodiedExtension, inlineExtension];
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Ensures presence of `fragment` mark on certain node types and the uniqueness of their `localId` attributes
|
|
27
|
-
*/
|
|
28
|
-
export const createPlugin = dispatch => new SafePlugin({
|
|
29
|
-
key: pluginKey,
|
|
30
|
-
appendTransaction: (transactions, _oldState, newState) => {
|
|
31
|
-
let modified = false;
|
|
32
|
-
const tr = newState.tr;
|
|
33
|
-
const {
|
|
34
|
-
fragment
|
|
35
|
-
} = newState.schema.marks;
|
|
36
|
-
const supportedNodeTypes = getNodesSupportingFragmentMark(newState.schema);
|
|
37
|
-
const addedSupportedNodes = new Set();
|
|
38
|
-
const addedSupportedNodesPos = new Map();
|
|
39
|
-
const localIds = new Set();
|
|
40
|
-
transactions.forEach(transaction => {
|
|
41
|
-
if (!transaction.docChanged) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Don't interfere with cut as it clashes with fixTables & we don't need
|
|
46
|
-
// to handle any extra cut cases in this plugin
|
|
47
|
-
const uiEvent = transaction.getMeta('uiEvent');
|
|
48
|
-
if (uiEvent === 'cut') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const changedNodes = getChangedNodes(transaction);
|
|
52
|
-
for (const {
|
|
53
|
-
node
|
|
54
|
-
} of changedNodes) {
|
|
55
|
-
if (!supportedNodeTypes.includes(node.type)) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
addedSupportedNodes.add(node);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
if (!addedSupportedNodes.size) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Get existing fragment marks localIds on the page
|
|
66
|
-
newState.doc.descendants((node, pos) => {
|
|
67
|
-
if (addedSupportedNodes.has(node)) {
|
|
68
|
-
addedSupportedNodesPos.set(node, pos);
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
if (!supportedNodeTypes.includes(node.type)) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
const existingFragmentMark = node.marks.find(mark => mark.type === fragment);
|
|
75
|
-
if (!existingFragmentMark) {
|
|
76
|
-
// continue traversing
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
localIds.add(existingFragmentMark.attrs.localId);
|
|
80
|
-
return true;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// If an added node has localId that collides with existing node, generate new localId
|
|
84
|
-
for (const node of addedSupportedNodes) {
|
|
85
|
-
const pos = addedSupportedNodesPos.get(node);
|
|
86
|
-
if (pos === undefined) {
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
const existingFragmentMark = node.marks.find(mark => mark.type === fragment);
|
|
90
|
-
if (!existingFragmentMark) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
if (localIds.has(existingFragmentMark.attrs.localId)) {
|
|
94
|
-
tr.setNodeMarkup(pos, undefined, node.attrs, node.marks.map(mark => {
|
|
95
|
-
if (mark.type !== fragment) {
|
|
96
|
-
return mark;
|
|
97
|
-
}
|
|
98
|
-
const fragmentMark = fragment.create({
|
|
99
|
-
...mark.attrs,
|
|
100
|
-
localId: uuid.generate(),
|
|
101
|
-
name: null
|
|
102
|
-
});
|
|
103
|
-
return fragmentMark;
|
|
104
|
-
}));
|
|
105
|
-
modified = true;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (modified) {
|
|
109
|
-
return tr;
|
|
110
|
-
}
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { drawFakeTextCursor } from './cursor';
|
|
4
|
-
export var stateKey = new PluginKey('fakeTextCursorPlugin');
|
|
5
|
-
export var createPlugin = function createPlugin() {
|
|
6
|
-
return new SafePlugin({
|
|
7
|
-
key: stateKey,
|
|
8
|
-
props: {
|
|
9
|
-
decorations: drawFakeTextCursor
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var fakeTextCursorPlugin = function fakeTextCursorPlugin() {
|
|
14
|
-
return {
|
|
15
|
-
name: 'fakeTextCursor',
|
|
16
|
-
pmPlugins: function pmPlugins() {
|
|
17
|
-
return [{
|
|
18
|
-
name: 'fakeTextCursor',
|
|
19
|
-
plugin: function plugin() {
|
|
20
|
-
return createPlugin();
|
|
21
|
-
}
|
|
22
|
-
}];
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export default fakeTextCursorPlugin;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { B75 } from '@atlaskit/theme/colors';
|
|
5
|
-
export var fakeCursorStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n .ProseMirror-fake-text-cursor {\n display: inline;\n pointer-events: none;\n position: relative;\n }\n\n .ProseMirror-fake-text-cursor::after {\n content: '';\n display: inline;\n top: 0;\n position: absolute;\n border-right: 1px solid ", ";\n }\n\n .ProseMirror-fake-text-selection {\n display: inline;\n pointer-events: none;\n position: relative;\n background-color: ", ";\n }\n }\n"])), "var(--ds-border, rgba(0, 0, 0, 0.4))", "var(--ds-background-selected, ".concat(B75, ")"));
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { fragment } from '@atlaskit/adf-schema';
|
|
2
|
-
import { createPlugin as createFragmentMarkConsistencyPlugin } from './pm-plugins/fragment-consistency';
|
|
3
|
-
var fragmentMarkPlugin = function fragmentMarkPlugin() {
|
|
4
|
-
return {
|
|
5
|
-
name: 'fragmentPlugin',
|
|
6
|
-
marks: function marks() {
|
|
7
|
-
return [{
|
|
8
|
-
name: 'fragment',
|
|
9
|
-
mark: fragment
|
|
10
|
-
}];
|
|
11
|
-
},
|
|
12
|
-
pmPlugins: function pmPlugins() {
|
|
13
|
-
return [{
|
|
14
|
-
name: 'fragmentMarkConsistency',
|
|
15
|
-
plugin: function plugin(_ref) {
|
|
16
|
-
var dispatch = _ref.dispatch;
|
|
17
|
-
return createFragmentMarkConsistencyPlugin(dispatch);
|
|
18
|
-
}
|
|
19
|
-
}];
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export default fragmentMarkPlugin;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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) { _defineProperty(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; }
|
|
4
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
-
/**
|
|
8
|
-
* This plugin ensures that certain nodes (such as tables, and various extension ones)
|
|
9
|
-
* have a unique `localId` attribute value for `fragment` marks.
|
|
10
|
-
* It also ensures the preservation of these IDs when nodes are being cut-and-pasted
|
|
11
|
-
* around the document.
|
|
12
|
-
*
|
|
13
|
-
* The implementation has been _heavily_ borrowed from
|
|
14
|
-
* - packages/editor/editor-core/src/plugins/table/pm-plugins/table-local-id.ts
|
|
15
|
-
*/
|
|
16
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
17
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
18
|
-
import { uuid } from '@atlaskit/adf-schema';
|
|
19
|
-
import { getChangedNodes } from '../../../utils/document';
|
|
20
|
-
var pluginKey = new PluginKey('fragmentMarkConsistencyPlugin');
|
|
21
|
-
var getNodesSupportingFragmentMark = function getNodesSupportingFragmentMark(schema) {
|
|
22
|
-
var _schema$nodes = schema.nodes,
|
|
23
|
-
table = _schema$nodes.table,
|
|
24
|
-
extension = _schema$nodes.extension,
|
|
25
|
-
bodiedExtension = _schema$nodes.bodiedExtension,
|
|
26
|
-
inlineExtension = _schema$nodes.inlineExtension;
|
|
27
|
-
return [table, extension, bodiedExtension, inlineExtension];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Ensures presence of `fragment` mark on certain node types and the uniqueness of their `localId` attributes
|
|
32
|
-
*/
|
|
33
|
-
export var createPlugin = function createPlugin(dispatch) {
|
|
34
|
-
return new SafePlugin({
|
|
35
|
-
key: pluginKey,
|
|
36
|
-
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
37
|
-
var modified = false;
|
|
38
|
-
var tr = newState.tr;
|
|
39
|
-
var fragment = newState.schema.marks.fragment;
|
|
40
|
-
var supportedNodeTypes = getNodesSupportingFragmentMark(newState.schema);
|
|
41
|
-
var addedSupportedNodes = new Set();
|
|
42
|
-
var addedSupportedNodesPos = new Map();
|
|
43
|
-
var localIds = new Set();
|
|
44
|
-
transactions.forEach(function (transaction) {
|
|
45
|
-
if (!transaction.docChanged) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Don't interfere with cut as it clashes with fixTables & we don't need
|
|
50
|
-
// to handle any extra cut cases in this plugin
|
|
51
|
-
var uiEvent = transaction.getMeta('uiEvent');
|
|
52
|
-
if (uiEvent === 'cut') {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
var changedNodes = getChangedNodes(transaction);
|
|
56
|
-
var _iterator = _createForOfIteratorHelper(changedNodes),
|
|
57
|
-
_step;
|
|
58
|
-
try {
|
|
59
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
60
|
-
var node = _step.value.node;
|
|
61
|
-
if (!supportedNodeTypes.includes(node.type)) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
addedSupportedNodes.add(node);
|
|
65
|
-
}
|
|
66
|
-
} catch (err) {
|
|
67
|
-
_iterator.e(err);
|
|
68
|
-
} finally {
|
|
69
|
-
_iterator.f();
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
if (!addedSupportedNodes.size) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Get existing fragment marks localIds on the page
|
|
77
|
-
newState.doc.descendants(function (node, pos) {
|
|
78
|
-
if (addedSupportedNodes.has(node)) {
|
|
79
|
-
addedSupportedNodesPos.set(node, pos);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
if (!supportedNodeTypes.includes(node.type)) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
var existingFragmentMark = node.marks.find(function (mark) {
|
|
86
|
-
return mark.type === fragment;
|
|
87
|
-
});
|
|
88
|
-
if (!existingFragmentMark) {
|
|
89
|
-
// continue traversing
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
localIds.add(existingFragmentMark.attrs.localId);
|
|
93
|
-
return true;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// If an added node has localId that collides with existing node, generate new localId
|
|
97
|
-
var _iterator2 = _createForOfIteratorHelper(addedSupportedNodes),
|
|
98
|
-
_step2;
|
|
99
|
-
try {
|
|
100
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
101
|
-
var node = _step2.value;
|
|
102
|
-
var pos = addedSupportedNodesPos.get(node);
|
|
103
|
-
if (pos === undefined) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
var existingFragmentMark = node.marks.find(function (mark) {
|
|
107
|
-
return mark.type === fragment;
|
|
108
|
-
});
|
|
109
|
-
if (!existingFragmentMark) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
if (localIds.has(existingFragmentMark.attrs.localId)) {
|
|
113
|
-
tr.setNodeMarkup(pos, undefined, node.attrs, node.marks.map(function (mark) {
|
|
114
|
-
if (mark.type !== fragment) {
|
|
115
|
-
return mark;
|
|
116
|
-
}
|
|
117
|
-
var fragmentMark = fragment.create(_objectSpread(_objectSpread({}, mark.attrs), {}, {
|
|
118
|
-
localId: uuid.generate(),
|
|
119
|
-
name: null
|
|
120
|
-
}));
|
|
121
|
-
return fragmentMark;
|
|
122
|
-
}));
|
|
123
|
-
modified = true;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
} catch (err) {
|
|
127
|
-
_iterator2.e(err);
|
|
128
|
-
} finally {
|
|
129
|
-
_iterator2.f();
|
|
130
|
-
}
|
|
131
|
-
if (modified) {
|
|
132
|
-
return tr;
|
|
133
|
-
}
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare const stateKey: PluginKey<any>;
|
|
5
|
-
export declare const createPlugin: () => SafePlugin<any>;
|
|
6
|
-
declare const fakeTextCursorPlugin: NextEditorPlugin<'fakeTextCursor'>;
|
|
7
|
-
export default fakeTextCursorPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const fakeCursorStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This plugin ensures that certain nodes (such as tables, and various extension ones)
|
|
3
|
-
* have a unique `localId` attribute value for `fragment` marks.
|
|
4
|
-
* It also ensures the preservation of these IDs when nodes are being cut-and-pasted
|
|
5
|
-
* around the document.
|
|
6
|
-
*
|
|
7
|
-
* The implementation has been _heavily_ borrowed from
|
|
8
|
-
* - packages/editor/editor-core/src/plugins/table/pm-plugins/table-local-id.ts
|
|
9
|
-
*/
|
|
10
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
|
-
import type { Dispatch } from '../../../event-dispatcher';
|
|
12
|
-
/**
|
|
13
|
-
* Ensures presence of `fragment` mark on certain node types and the uniqueness of their `localId` attributes
|
|
14
|
-
*/
|
|
15
|
-
export declare const createPlugin: (dispatch: Dispatch) => SafePlugin<any>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare const stateKey: PluginKey<any>;
|
|
5
|
-
export declare const createPlugin: () => SafePlugin<any>;
|
|
6
|
-
declare const fakeTextCursorPlugin: NextEditorPlugin<'fakeTextCursor'>;
|
|
7
|
-
export default fakeTextCursorPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const fakeCursorStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This plugin ensures that certain nodes (such as tables, and various extension ones)
|
|
3
|
-
* have a unique `localId` attribute value for `fragment` marks.
|
|
4
|
-
* It also ensures the preservation of these IDs when nodes are being cut-and-pasted
|
|
5
|
-
* around the document.
|
|
6
|
-
*
|
|
7
|
-
* The implementation has been _heavily_ borrowed from
|
|
8
|
-
* - packages/editor/editor-core/src/plugins/table/pm-plugins/table-local-id.ts
|
|
9
|
-
*/
|
|
10
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
|
-
import type { Dispatch } from '../../../event-dispatcher';
|
|
12
|
-
/**
|
|
13
|
-
* Ensures presence of `fragment` mark on certain node types and the uniqueness of their `localId` attributes
|
|
14
|
-
*/
|
|
15
|
-
export declare const createPlugin: (dispatch: Dispatch) => SafePlugin<any>;
|
|
File without changes
|
/package/dist/es2019/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/types/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.d.ts
RENAMED
|
File without changes
|
/package/dist/types-ts4.5/plugins/{fake-text-cursor → placeholder-text/fake-text-cursor}/cursor.d.ts
RENAMED
|
File without changes
|