@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
|
@@ -19,7 +19,6 @@ var _editorPluginFocus = require("@atlaskit/editor-plugin-focus");
|
|
|
19
19
|
var _editorPluginEditorDisabled = require("@atlaskit/editor-plugin-editor-disabled");
|
|
20
20
|
var _editorPluginTypeAhead = require("@atlaskit/editor-plugin-type-ahead");
|
|
21
21
|
var _editorPluginSubmitEditor = require("@atlaskit/editor-plugin-submit-editor");
|
|
22
|
-
var _fakeTextCursor = _interopRequireDefault(require("../plugins/fake-text-cursor"));
|
|
23
22
|
var _editorPluginFeatureFlags = require("@atlaskit/editor-plugin-feature-flags");
|
|
24
23
|
var _editorPluginCopyButton = require("@atlaskit/editor-plugin-copy-button");
|
|
25
24
|
var _editorPluginFloatingToolbar = require("@atlaskit/editor-plugin-floating-toolbar");
|
|
@@ -90,7 +89,7 @@ function createDefaultPreset(options) {
|
|
|
90
89
|
return builder;
|
|
91
90
|
}).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_editorPluginQuickInsert.quickInsertPlugin, options.quickInsert]).add([_editorPluginTypeAhead.typeAheadPlugin, options.typeAhead || {
|
|
92
91
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
93
|
-
}]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_editorPluginSubmitEditor.submitEditorPlugin, options.submitEditor]).add(
|
|
92
|
+
}]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_editorPluginSubmitEditor.submitEditorPlugin, options.submitEditor]).add(_editorPluginCopyButton.copyButtonPlugin).add(_editorPluginFloatingToolbar.floatingToolbarPlugin).add([_editorPluginSelection.selectionPlugin, options.selection]).add([_codeBlock.default, options.codeBlock || {
|
|
94
93
|
appearance: 'full-page'
|
|
95
94
|
}]);
|
|
96
95
|
return preset;
|
|
@@ -17,6 +17,7 @@ var _editorPluginBorder = require("@atlaskit/editor-plugin-border");
|
|
|
17
17
|
var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
|
|
18
18
|
var _editorPluginMedia = require("@atlaskit/editor-plugin-media");
|
|
19
19
|
var _editorPluginRule = require("@atlaskit/editor-plugin-rule");
|
|
20
|
+
var _editorPluginFragment = require("@atlaskit/editor-plugin-fragment");
|
|
20
21
|
var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
|
|
21
22
|
var _editorPluginPasteOptionsToolbar = require("@atlaskit/editor-plugin-paste-options-toolbar");
|
|
22
23
|
var _editorPluginList = require("@atlaskit/editor-plugin-list");
|
|
@@ -391,7 +392,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
391
392
|
return builder.add(plugin);
|
|
392
393
|
}
|
|
393
394
|
return builder;
|
|
394
|
-
}).maybeAdd(
|
|
395
|
+
}).maybeAdd(_editorPluginFragment.fragmentPlugin, function (plugin, builder) {
|
|
395
396
|
if (props.allowFragmentMark) {
|
|
396
397
|
return builder.add(plugin);
|
|
397
398
|
}
|
|
@@ -20,12 +20,11 @@ var _styles5 = require("../../plugins/code-block/styles");
|
|
|
20
20
|
var _media = require("./media");
|
|
21
21
|
var _styles6 = require("../../plugins/layout/styles");
|
|
22
22
|
var _styles7 = require("../../plugins/panel/styles");
|
|
23
|
-
var _styles8 = require("../../plugins/
|
|
24
|
-
var _styles9 = require("../../plugins/
|
|
25
|
-
var _styles10 = require("../../plugins/
|
|
26
|
-
var _styles11 = require("../../plugins/
|
|
27
|
-
var _styles12 = require("../../plugins/
|
|
28
|
-
var _styles13 = require("../../plugins/tasks-and-decisions/styles");
|
|
23
|
+
var _styles8 = require("../../plugins/placeholder-text/styles");
|
|
24
|
+
var _styles9 = require("../../plugins/extension/ui/styles");
|
|
25
|
+
var _styles10 = require("../../plugins/expand/ui/styles");
|
|
26
|
+
var _styles11 = require("../../plugins/find-replace/styles");
|
|
27
|
+
var _styles12 = require("../../plugins/tasks-and-decisions/styles");
|
|
29
28
|
var _status = require("./status");
|
|
30
29
|
var _date = require("./date");
|
|
31
30
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
@@ -46,9 +45,9 @@ var listsStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _
|
|
|
46
45
|
var emojiStyles = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
|
|
47
46
|
var placeholderStyles = exports.placeholderStyles = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .placeholder-decoration {\n color: ", ";\n width: 100%;\n pointer-events: none;\n user-select: none;\n\n .placeholder-android {\n pointer-events: none;\n outline: none;\n user-select: none;\n position: absolute;\n }\n }\n"])), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"));
|
|
48
47
|
var contentStyles = function contentStyles(props) {
|
|
49
|
-
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n
|
|
48
|
+
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
|
|
50
49
|
theme: props.theme
|
|
51
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)",
|
|
50
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles8.placeholderTextStyles, placeholderStyles, (0, _styles5.codeBlockStyles)(props), (0, _styles3.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _media.mediaStyles, (0, _styles6.layoutStyles)(props), _styles2.telepointerStyle, _selection.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles7.panelStyles)(props), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles9.extensionStyles, (0, _styles10.expandStyles)(props), _styles11.findReplaceStyles, _styles4.textHighlightStyle, _styles12.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
52
51
|
};
|
|
53
52
|
var createEditorContentStyle = exports.createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
54
53
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "findFarthestParentNode", {
|
|
|
10
10
|
return _utils.findFarthestParentNode;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
exports.getChangedNodes = getChangedNodes;
|
|
14
|
-
exports.getChangedNodesIn = getChangedNodesIn;
|
|
15
13
|
exports.getChildBreakoutModes = getChildBreakoutModes;
|
|
16
14
|
exports.getNodesCount = getNodesCount;
|
|
17
15
|
Object.defineProperty(exports, "isInEmptyLine", {
|
|
@@ -40,30 +38,6 @@ function processRawFragmentValue(schema, value, providerFactory, sanitizePrivate
|
|
|
40
38
|
}
|
|
41
39
|
return _model.Fragment.from(adfEntities);
|
|
42
40
|
}
|
|
43
|
-
function getChangedNodesIn(_ref) {
|
|
44
|
-
var tr = _ref.tr,
|
|
45
|
-
doc = _ref.doc;
|
|
46
|
-
var nodes = [];
|
|
47
|
-
var stepRange = (0, _utils.getStepRange)(tr);
|
|
48
|
-
if (!stepRange) {
|
|
49
|
-
return nodes;
|
|
50
|
-
}
|
|
51
|
-
var from = Math.min(doc.nodeSize - 2, stepRange.from);
|
|
52
|
-
var to = Math.min(doc.nodeSize - 2, stepRange.to);
|
|
53
|
-
doc.nodesBetween(from, to, function (node, pos) {
|
|
54
|
-
nodes.push({
|
|
55
|
-
node: node,
|
|
56
|
-
pos: pos
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
return nodes;
|
|
60
|
-
}
|
|
61
|
-
function getChangedNodes(tr) {
|
|
62
|
-
return getChangedNodesIn({
|
|
63
|
-
tr: tr,
|
|
64
|
-
doc: tr.doc
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
41
|
function nodesBetweenChanged(tr, f, startPos) {
|
|
68
42
|
var stepRange = (0, _utils.getStepRange)(tr);
|
|
69
43
|
if (!stepRange) {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -147,7 +147,6 @@ Object.defineProperty(exports, "toJSON", {
|
|
|
147
147
|
});
|
|
148
148
|
exports.whichTransitionEvent = whichTransitionEvent;
|
|
149
149
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
150
|
-
var _cursor = require("../plugins/fake-text-cursor/cursor");
|
|
151
150
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
152
151
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
153
152
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
@@ -173,9 +172,6 @@ function getCursor(selection) {
|
|
|
173
172
|
* allowed.
|
|
174
173
|
*/
|
|
175
174
|
function isMarkTypeAllowedInCurrentSelection(markType, state) {
|
|
176
|
-
if (state.selection instanceof _cursor.FakeTextCursorSelection) {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
175
|
if (!isMarkTypeAllowedInNode(markType, state)) {
|
|
180
176
|
return false;
|
|
181
177
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "189.
|
|
8
|
+
var version = exports.version = "189.1.1";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getChangedNodes } from '
|
|
1
|
+
export { getChangedNodes } from '@atlaskit/editor-common/utils';
|
|
2
2
|
export { validateNodes } from './utils/nodes';
|
|
3
3
|
export { toJSON } from './utils';
|
|
4
4
|
export { default as Extension } from './plugins/extension/ui/Extension';
|
|
@@ -5,14 +5,14 @@ import { isSelectionValid, getPluginState } from '../utils';
|
|
|
5
5
|
import { ACTIONS } from '../pm-plugins/types';
|
|
6
6
|
import transform from './transform';
|
|
7
7
|
import { AnnotationSelectionType } from '../types';
|
|
8
|
-
export const updateInlineCommentResolvedState = (partialNewState, resolveMethod) => {
|
|
8
|
+
export const updateInlineCommentResolvedState = editorAnalyticsAPI => (partialNewState, resolveMethod) => {
|
|
9
9
|
const command = {
|
|
10
10
|
type: ACTIONS.UPDATE_INLINE_COMMENT_STATE,
|
|
11
11
|
data: partialNewState
|
|
12
12
|
};
|
|
13
13
|
const allResolved = Object.values(partialNewState).every(state => state);
|
|
14
14
|
if (resolveMethod && allResolved) {
|
|
15
|
-
return createCommand(command, transform.addResolveAnalytics(resolveMethod));
|
|
15
|
+
return createCommand(command, transform.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
|
|
16
16
|
}
|
|
17
17
|
return createCommand(command);
|
|
18
18
|
};
|
|
@@ -62,11 +62,11 @@ const getDraftCommandAction = drafting => {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
export const setInlineCommentDraftState = (drafting, inputMethod = INPUT_METHOD.TOOLBAR) => {
|
|
65
|
+
export const setInlineCommentDraftState = editorAnalyticsAPI => (drafting, inputMethod = INPUT_METHOD.TOOLBAR) => {
|
|
66
66
|
const commandAction = getDraftCommandAction(drafting);
|
|
67
|
-
return createCommand(commandAction, transform.addOpenCloseAnalytics(drafting, inputMethod));
|
|
67
|
+
return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
|
|
68
68
|
};
|
|
69
|
-
export const addInlineComment = id => {
|
|
69
|
+
export const addInlineComment = editorAnalyticsAPI => id => {
|
|
70
70
|
const commandAction = editorState => ({
|
|
71
71
|
type: ACTIONS.ADD_INLINE_COMMENT,
|
|
72
72
|
data: {
|
|
@@ -83,7 +83,7 @@ export const addInlineComment = id => {
|
|
|
83
83
|
editorState
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
return createCommand(commandAction, transform.addInlineComment(id));
|
|
86
|
+
return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI)(id));
|
|
87
87
|
};
|
|
88
88
|
export const updateMouseState = mouseData => createCommand({
|
|
89
89
|
type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE,
|
|
@@ -100,7 +100,7 @@ export const setSelectedAnnotation = id => createCommand({
|
|
|
100
100
|
}]
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
|
|
103
|
+
export const createAnnotation = editorAnalyticsAPI => (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
|
|
104
104
|
// don't try to add if there are is no temp highlight bookmarked
|
|
105
105
|
const {
|
|
106
106
|
bookmark
|
|
@@ -109,7 +109,7 @@ export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COM
|
|
|
109
109
|
return false;
|
|
110
110
|
}
|
|
111
111
|
if (annotationType === AnnotationTypes.INLINE_COMMENT) {
|
|
112
|
-
return addInlineComment(id)(state, dispatch);
|
|
112
|
+
return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
|
|
113
113
|
}
|
|
114
114
|
return false;
|
|
115
115
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { addAnalytics } from '../../analytics/utils';
|
|
5
4
|
import { getSelectionPositions, getPluginState, getDraftCommandAnalyticsPayload } from '../utils';
|
|
6
5
|
import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
|
|
7
6
|
const addAnnotationMark = id => (transaction, state) => {
|
|
@@ -21,27 +20,29 @@ const addAnnotationMark = id => (transaction, state) => {
|
|
|
21
20
|
tr.setSelection(TextSelection.create(tr.doc, head));
|
|
22
21
|
return tr;
|
|
23
22
|
};
|
|
24
|
-
const addInlineComment = id => (transaction, state) => {
|
|
23
|
+
const addInlineComment = editorAnalyticsAPI => id => (transaction, state) => {
|
|
25
24
|
let tr = addAnnotationMark(id)(transaction, state);
|
|
26
25
|
// add insert analytics step to transaction
|
|
27
|
-
tr = addInsertAnalytics(tr, state);
|
|
26
|
+
tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
|
|
28
27
|
// add close analytics step to transaction
|
|
29
|
-
tr = addOpenCloseAnalytics(false, INPUT_METHOD.TOOLBAR)(tr, state);
|
|
28
|
+
tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false, INPUT_METHOD.TOOLBAR)(tr, state);
|
|
30
29
|
return tr;
|
|
31
30
|
};
|
|
32
|
-
const addOpenCloseAnalytics = (drafting, method = INPUT_METHOD.TOOLBAR) => (transaction, state) => {
|
|
31
|
+
const addOpenCloseAnalytics = editorAnalyticsAPI => (drafting, method = INPUT_METHOD.TOOLBAR) => (transaction, state) => {
|
|
33
32
|
const draftingPayload = getDraftCommandAnalyticsPayload(drafting, method)(state);
|
|
34
|
-
|
|
33
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(draftingPayload)(transaction);
|
|
34
|
+
return transaction;
|
|
35
35
|
};
|
|
36
|
-
const addInsertAnalytics = (transaction, state) => {
|
|
37
|
-
|
|
36
|
+
const addInsertAnalytics = editorAnalyticsAPI => (transaction, state) => {
|
|
37
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
38
38
|
action: ACTION.INSERTED,
|
|
39
39
|
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
40
40
|
eventType: EVENT_TYPE.TRACK,
|
|
41
41
|
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT
|
|
42
|
-
});
|
|
42
|
+
})(transaction);
|
|
43
|
+
return transaction;
|
|
43
44
|
};
|
|
44
|
-
const addResolveAnalytics = method => (transaction, state) => {
|
|
45
|
+
const addResolveAnalytics = editorAnalyticsAPI => method => (transaction, state) => {
|
|
45
46
|
const resolvedPayload = {
|
|
46
47
|
action: ACTION.RESOLVED,
|
|
47
48
|
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
@@ -51,7 +52,8 @@ const addResolveAnalytics = method => (transaction, state) => {
|
|
|
51
52
|
method
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(resolvedPayload)(transaction);
|
|
56
|
+
return transaction;
|
|
55
57
|
};
|
|
56
58
|
export default {
|
|
57
59
|
addAnnotationMark,
|
|
@@ -34,11 +34,13 @@ const annotationPlugin = ({
|
|
|
34
34
|
eventDispatcher
|
|
35
35
|
}) => {
|
|
36
36
|
if (annotationProviders) {
|
|
37
|
+
var _api$analytics;
|
|
37
38
|
return inlineCommentPlugin({
|
|
38
39
|
dispatch,
|
|
39
40
|
portalProviderAPI,
|
|
40
41
|
eventDispatcher,
|
|
41
|
-
provider: annotationProviders.inlineComment
|
|
42
|
+
provider: annotationProviders.inlineComment,
|
|
43
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
return;
|
|
@@ -47,7 +49,8 @@ const annotationPlugin = ({
|
|
|
47
49
|
name: 'annotationKeymap',
|
|
48
50
|
plugin: () => {
|
|
49
51
|
if (annotationProviders) {
|
|
50
|
-
|
|
52
|
+
var _api$analytics2;
|
|
53
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
51
54
|
}
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
@@ -59,10 +62,11 @@ const annotationPlugin = ({
|
|
|
59
62
|
}
|
|
60
63
|
const pluginState = getPluginState(state);
|
|
61
64
|
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
65
|
+
var _api$analytics3;
|
|
62
66
|
const {
|
|
63
67
|
isToolbarAbove
|
|
64
68
|
} = annotationProviders.inlineComment;
|
|
65
|
-
return buildToolbar(state, intl, isToolbarAbove);
|
|
69
|
+
return buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, intl, isToolbarAbove);
|
|
66
70
|
}
|
|
67
71
|
},
|
|
68
72
|
selectionToolbar(state, intl) {
|
|
@@ -71,10 +75,11 @@ const annotationPlugin = ({
|
|
|
71
75
|
}
|
|
72
76
|
const pluginState = getPluginState(state);
|
|
73
77
|
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
78
|
+
var _api$analytics4;
|
|
74
79
|
const {
|
|
75
80
|
isToolbarAbove
|
|
76
81
|
} = annotationProviders.inlineComment;
|
|
77
|
-
return buildToolbar(state, intl, isToolbarAbove);
|
|
82
|
+
return buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(state, intl, isToolbarAbove);
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
},
|
|
@@ -100,6 +105,7 @@ function AnnotationContentComponent({
|
|
|
100
105
|
annotationProviders,
|
|
101
106
|
dispatchAnalyticsEvent
|
|
102
107
|
}) {
|
|
108
|
+
var _api$analytics5;
|
|
103
109
|
const {
|
|
104
110
|
annotationState: inlineCommentState
|
|
105
111
|
} = useSharedPluginState(api, ['annotation']);
|
|
@@ -111,7 +117,8 @@ function AnnotationContentComponent({
|
|
|
111
117
|
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
112
118
|
providers: annotationProviders,
|
|
113
119
|
editorView: editorView,
|
|
114
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
120
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
121
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
|
|
115
122
|
}));
|
|
116
123
|
}
|
|
117
124
|
export default annotationPlugin;
|
|
@@ -19,13 +19,13 @@ const fetchProviderStates = async (provider, annotationIds) => {
|
|
|
19
19
|
|
|
20
20
|
// fetchState is unable to return a command as it's runs async and may dispatch at a later time
|
|
21
21
|
// Requires `editorView` instead of the decomposition as the async means state may end up stale
|
|
22
|
-
const fetchState = async (provider, annotationIds, editorView) => {
|
|
22
|
+
const fetchState = async (provider, annotationIds, editorView, editorAnalyticsAPI) => {
|
|
23
23
|
if (!annotationIds || !annotationIds.length) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
const inlineCommentStates = await fetchProviderStates(provider, annotationIds);
|
|
27
27
|
if (editorView.dispatch) {
|
|
28
|
-
updateInlineCommentResolvedState(inlineCommentStates)(editorView.state, editorView.dispatch);
|
|
28
|
+
updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
const initialState = (disallowOnWhitespace = false) => {
|
|
@@ -47,13 +47,13 @@ const hideToolbar = (state, dispatch) => () => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
// Subscribe to updates from consumer
|
|
50
|
-
const onResolve = (state, dispatch) => annotationId => {
|
|
51
|
-
updateInlineCommentResolvedState({
|
|
50
|
+
const onResolve = editorAnalyticsAPI => (state, dispatch) => annotationId => {
|
|
51
|
+
updateInlineCommentResolvedState(editorAnalyticsAPI)({
|
|
52
52
|
[annotationId]: true
|
|
53
53
|
}, RESOLVE_METHOD.CONSUMER)(state, dispatch);
|
|
54
54
|
};
|
|
55
|
-
const onUnResolve = (state, dispatch) => annotationId => {
|
|
56
|
-
updateInlineCommentResolvedState({
|
|
55
|
+
const onUnResolve = editorAnalyticsAPI => (state, dispatch) => annotationId => {
|
|
56
|
+
updateInlineCommentResolvedState(editorAnalyticsAPI)({
|
|
57
57
|
[annotationId]: false
|
|
58
58
|
})(state, dispatch);
|
|
59
59
|
};
|
|
@@ -93,9 +93,9 @@ export const inlineCommentPlugin = options => {
|
|
|
93
93
|
view(editorView) {
|
|
94
94
|
// Get initial state
|
|
95
95
|
// Need to pass `editorView` to mitigate editor state going stale
|
|
96
|
-
fetchState(provider, getAllAnnotations(editorView.state.doc), editorView);
|
|
97
|
-
const resolve = annotationId => onResolve(editorView.state, editorView.dispatch)(annotationId);
|
|
98
|
-
const unResolve = annotationId => onUnResolve(editorView.state, editorView.dispatch)(annotationId);
|
|
96
|
+
fetchState(provider, getAllAnnotations(editorView.state.doc), editorView, options.editorAnalyticsAPI);
|
|
97
|
+
const resolve = annotationId => onResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
|
|
98
|
+
const unResolve = annotationId => onUnResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
|
|
99
99
|
const mouseUp = event => onMouseUp(editorView.state, editorView.dispatch)(event);
|
|
100
100
|
const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
|
|
101
101
|
const setSelectedAnnotationFn = annotationId => {
|
|
@@ -121,7 +121,7 @@ export const inlineCommentPlugin = options => {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
clearDirtyMark()(view.state, view.dispatch);
|
|
124
|
-
fetchState(provider, getAllAnnotations(view.state.doc), view);
|
|
124
|
+
fetchState(provider, getAllAnnotations(view.state.doc), view, options.editorAnalyticsAPI);
|
|
125
125
|
},
|
|
126
126
|
destroy() {
|
|
127
127
|
editorView.root.removeEventListener('mouseup', mouseUp);
|
|
@@ -2,8 +2,8 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
|
2
2
|
import { bindKeymapWithCommand, addInlineComment } from '../../../keymaps';
|
|
3
3
|
import { setInlineCommentDraftState } from '../commands';
|
|
4
4
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
|
-
export function keymapPlugin() {
|
|
5
|
+
export function keymapPlugin(editorAnalyticsAPI) {
|
|
6
6
|
const list = {};
|
|
7
|
-
bindKeymapWithCommand(addInlineComment.common, setInlineCommentDraftState(true, INPUT_METHOD.SHORTCUT), list);
|
|
7
|
+
bindKeymapWithCommand(addInlineComment.common, setInlineCommentDraftState(editorAnalyticsAPI)(true, INPUT_METHOD.SHORTCUT), list);
|
|
8
8
|
return keymap(list);
|
|
9
9
|
}
|
|
@@ -6,7 +6,7 @@ import { AnnotationTestIds, AnnotationSelectionType } from './types';
|
|
|
6
6
|
import { isSelectionValid } from './utils';
|
|
7
7
|
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
9
|
-
export const buildToolbar = (state, intl, isToolbarAbove = false) => {
|
|
9
|
+
export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove = false) => {
|
|
10
10
|
const {
|
|
11
11
|
schema
|
|
12
12
|
} = state;
|
|
@@ -28,7 +28,7 @@ export const buildToolbar = (state, intl, isToolbarAbove = false) => {
|
|
|
28
28
|
}),
|
|
29
29
|
title: createCommentMessage,
|
|
30
30
|
onClick: (state, dispatch) => {
|
|
31
|
-
return setInlineCommentDraftState(true)(state, dispatch);
|
|
31
|
+
return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
const {
|
|
@@ -26,6 +26,7 @@ const findPosForDOM = sel => {
|
|
|
26
26
|
export function InlineCommentView({
|
|
27
27
|
providers,
|
|
28
28
|
editorView,
|
|
29
|
+
editorAnalyticsAPI,
|
|
29
30
|
dispatchAnalyticsEvent
|
|
30
31
|
}) {
|
|
31
32
|
// As inlineComment is the only annotation present, this function is not generic
|
|
@@ -93,11 +94,11 @@ export function InlineCommentView({
|
|
|
93
94
|
dom: dom,
|
|
94
95
|
textSelection: textSelection,
|
|
95
96
|
onCreate: id => {
|
|
96
|
-
createAnnotation(id)(editorView.state, editorView.dispatch);
|
|
97
|
+
createAnnotation(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
|
|
97
98
|
!editorView.hasFocus() && editorView.focus();
|
|
98
99
|
},
|
|
99
100
|
onClose: () => {
|
|
100
|
-
setInlineCommentDraftState(false)(editorView.state, editorView.dispatch);
|
|
101
|
+
setInlineCommentDraftState(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
|
|
101
102
|
!editorView.hasFocus() && editorView.focus();
|
|
102
103
|
}
|
|
103
104
|
}));
|
|
@@ -137,7 +138,7 @@ export function InlineCommentView({
|
|
|
137
138
|
annotations: activeAnnotations,
|
|
138
139
|
dom: dom,
|
|
139
140
|
onDelete: id => removeInlineCommentNearSelection(id)(state, dispatch),
|
|
140
|
-
onResolve: id => updateInlineCommentResolvedState({
|
|
141
|
+
onResolve: id => updateInlineCommentResolvedState(editorAnalyticsAPI)({
|
|
141
142
|
[id]: true
|
|
142
143
|
}, RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch),
|
|
143
144
|
onClose: () => {
|
|
@@ -2,7 +2,6 @@ export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-mark
|
|
|
2
2
|
export { default as codeBlockPlugin } from './code-block';
|
|
3
3
|
export { default as collabEditPlugin } from './collab-edit';
|
|
4
4
|
export { default as extensionPlugin } from './extension';
|
|
5
|
-
export { default as fakeTextCursorPlugin } from './fake-text-cursor';
|
|
6
5
|
export { default as insertBlockPlugin } from './insert-block';
|
|
7
6
|
export { default as jiraIssuePlugin } from './jira-issue';
|
|
8
7
|
export { default as layoutPlugin } from './layout';
|
|
@@ -16,7 +15,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
|
16
15
|
export { default as breakoutPlugin } from './breakout';
|
|
17
16
|
export { default as alignmentPlugin } from './alignment';
|
|
18
17
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
19
|
-
export { default as fragmentMarkPlugin } from './fragment';
|
|
20
18
|
export { default as indentationPlugin } from './indentation';
|
|
21
19
|
export { default as annotationPlugin } from './annotation';
|
|
22
20
|
export { default as analyticsPlugin } from './analytics';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as placeholderTextPlugin } from './plugin';
|
|
1
|
+
export { default as placeholderTextPlugin } from './plugin';
|
|
2
|
+
export { FakeTextCursorSelection } from './fake-text-cursor/cursor';
|
|
@@ -5,7 +5,7 @@ import { placeholder } from '@atlaskit/adf-schema';
|
|
|
5
5
|
import MediaServicesTextIcon from '@atlaskit/icon/glyph/media-services/text';
|
|
6
6
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { isNodeEmpty } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { FakeTextCursorSelection } from '
|
|
8
|
+
import { drawFakeTextCursor, FakeTextCursorSelection } from './fake-text-cursor/cursor';
|
|
9
9
|
import PlaceholderFloatingToolbar from './ui/PlaceholderFloatingToolbar';
|
|
10
10
|
import { hidePlaceholderFloatingToolbar, insertPlaceholderTextAtSelection } from './actions';
|
|
11
11
|
import { PlaceholderTextNodeView } from './placeholder-text-nodeview';
|
|
@@ -93,6 +93,7 @@ export function createPlugin(dispatch, options, api) {
|
|
|
93
93
|
return;
|
|
94
94
|
},
|
|
95
95
|
props: {
|
|
96
|
+
decorations: drawFakeTextCursor,
|
|
96
97
|
handleDOMEvents: {
|
|
97
98
|
beforeinput: (view, event) => {
|
|
98
99
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { N200 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { B75, N200 } from '@atlaskit/theme/colors';
|
|
3
3
|
import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
export const placeholderTextStyles = css`
|
|
5
5
|
.ProseMirror span[data-placeholder] {
|
|
@@ -26,4 +26,27 @@ export const placeholderTextStyles = css`
|
|
|
26
26
|
content: attr(data-placeholder);
|
|
27
27
|
display: inline;
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
.ProseMirror {
|
|
31
|
+
.ProseMirror-fake-text-cursor {
|
|
32
|
+
display: inline;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ProseMirror-fake-text-cursor::after {
|
|
38
|
+
content: '';
|
|
39
|
+
display: inline;
|
|
40
|
+
top: 0;
|
|
41
|
+
position: absolute;
|
|
42
|
+
border-right: 1px solid ${"var(--ds-border, rgba(0, 0, 0, 0.4))"};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ProseMirror-fake-text-selection {
|
|
46
|
+
display: inline;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
position: relative;
|
|
49
|
+
background-color: ${`var(--ds-background-selected, ${B75})`};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
29
52
|
`;
|
|
@@ -13,7 +13,6 @@ import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
|
13
13
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
14
14
|
import { typeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
15
15
|
import { submitEditorPlugin } from '@atlaskit/editor-plugin-submit-editor';
|
|
16
|
-
import fakeTextCursorPlugin from '../plugins/fake-text-cursor';
|
|
17
16
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
18
17
|
import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
|
|
19
18
|
import { floatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
@@ -86,7 +85,7 @@ export function createDefaultPreset(options) {
|
|
|
86
85
|
return builder;
|
|
87
86
|
}).add([hyperlinkPlugin, options.hyperlinkOptions]).add([textFormattingPlugin, options.textFormatting]).add(widthPlugin).add([quickInsertPlugin, options.quickInsert]).add([typeAheadPlugin, options.typeAhead || {
|
|
88
87
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
89
|
-
}]).add([placeholderPlugin, options.placeholder]).add(unsupportedContentPlugin).add(editorDisabledPlugin).add([submitEditorPlugin, options.submitEditor]).add(
|
|
88
|
+
}]).add([placeholderPlugin, options.placeholder]).add(unsupportedContentPlugin).add(editorDisabledPlugin).add([submitEditorPlugin, options.submitEditor]).add(copyButtonPlugin).add(floatingToolbarPlugin).add([selectionPlugin, options.selection]).add([codeBlockPlugin, options.codeBlock || {
|
|
90
89
|
appearance: 'full-page'
|
|
91
90
|
}]);
|
|
92
91
|
return preset;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin,
|
|
1
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
|
|
2
2
|
import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
|
|
3
3
|
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
4
4
|
import { statusPlugin } from '@atlaskit/editor-plugin-status';
|
|
@@ -8,6 +8,7 @@ import { borderPlugin } from '@atlaskit/editor-plugin-border';
|
|
|
8
8
|
import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
|
|
9
9
|
import { mediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
10
10
|
import { rulePlugin } from '@atlaskit/editor-plugin-rule';
|
|
11
|
+
import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
|
|
11
12
|
import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
12
13
|
import { pasteOptionsToolbarPlugin } from '@atlaskit/editor-plugin-paste-options-toolbar';
|
|
13
14
|
import { listPlugin } from '@atlaskit/editor-plugin-list';
|
|
@@ -388,7 +389,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
388
389
|
return builder.add(plugin);
|
|
389
390
|
}
|
|
390
391
|
return builder;
|
|
391
|
-
}).maybeAdd(
|
|
392
|
+
}).maybeAdd(fragmentPlugin, (plugin, builder) => {
|
|
392
393
|
if (props.allowFragmentMark) {
|
|
393
394
|
return builder.add(plugin);
|
|
394
395
|
}
|
|
@@ -12,7 +12,6 @@ import { codeBlockStyles } from '../../plugins/code-block/styles';
|
|
|
12
12
|
import { mediaStyles } from './media';
|
|
13
13
|
import { layoutStyles } from '../../plugins/layout/styles';
|
|
14
14
|
import { panelStyles } from '../../plugins/panel/styles';
|
|
15
|
-
import { fakeCursorStyles } from '../../plugins/fake-text-cursor/styles';
|
|
16
15
|
import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
|
|
17
16
|
import { extensionStyles } from '../../plugins/extension/ui/styles';
|
|
18
17
|
import { expandStyles } from '../../plugins/expand/ui/styles';
|
|
@@ -183,7 +182,6 @@ const contentStyles = props => css`
|
|
|
183
182
|
${gapCursorStyles};
|
|
184
183
|
${tableStyles(props)}
|
|
185
184
|
${panelStyles(props)}
|
|
186
|
-
${fakeCursorStyles}
|
|
187
185
|
${mentionsStyles}
|
|
188
186
|
${emojiStyles}
|
|
189
187
|
${tasksAndDecisionsStyles}
|
|
@@ -12,31 +12,6 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
|
|
|
12
12
|
}
|
|
13
13
|
return Fragment.from(adfEntities);
|
|
14
14
|
}
|
|
15
|
-
export function getChangedNodesIn({
|
|
16
|
-
tr,
|
|
17
|
-
doc
|
|
18
|
-
}) {
|
|
19
|
-
const nodes = [];
|
|
20
|
-
const stepRange = getStepRange(tr);
|
|
21
|
-
if (!stepRange) {
|
|
22
|
-
return nodes;
|
|
23
|
-
}
|
|
24
|
-
const from = Math.min(doc.nodeSize - 2, stepRange.from);
|
|
25
|
-
const to = Math.min(doc.nodeSize - 2, stepRange.to);
|
|
26
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
27
|
-
nodes.push({
|
|
28
|
-
node,
|
|
29
|
-
pos
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
return nodes;
|
|
33
|
-
}
|
|
34
|
-
export function getChangedNodes(tr) {
|
|
35
|
-
return getChangedNodesIn({
|
|
36
|
-
tr: tr,
|
|
37
|
-
doc: tr.doc
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
15
|
export function nodesBetweenChanged(tr, f, startPos) {
|
|
41
16
|
const stepRange = getStepRange(tr);
|
|
42
17
|
if (!stepRange) {
|