@atlaskit/editor-core 164.0.4 → 166.0.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 +43 -0
- package/dist/cjs/actions/index.js +9 -0
- package/dist/cjs/create-editor/ReactEditorView.js +14 -6
- package/dist/cjs/create-editor/create-plugins-list.js +1 -2
- package/dist/cjs/editor.js +13 -0
- package/dist/cjs/event-dispatcher/index.js +9 -0
- package/dist/cjs/nodeviews/ReactNodeView.js +1 -11
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/cjs/nodeviews/getPerformanceOptions.js +1 -1
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +157 -0
- package/dist/cjs/plugins/card/styles.js +3 -1
- package/dist/cjs/plugins/code-block/styles.js +6 -4
- package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
- package/dist/cjs/plugins/date/styles.js +3 -1
- package/dist/cjs/plugins/emoji/index.js +30 -34
- package/dist/cjs/plugins/emoji/nodeviews/emoji.js +12 -66
- package/dist/cjs/plugins/emoji/styles.js +3 -17
- package/dist/cjs/plugins/expand/ui/styles.js +2 -2
- package/dist/cjs/plugins/extension/ui/styles.js +3 -1
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +1 -9
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +1 -9
- package/dist/cjs/plugins/layout/styles.js +3 -1
- package/dist/cjs/plugins/list/commands/indent-list.js +5 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +5 -1
- package/dist/cjs/plugins/list/transforms.js +11 -3
- package/dist/cjs/plugins/media/styles.js +3 -1
- package/dist/cjs/plugins/mentions/index.js +10 -14
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +15 -67
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +19 -10
- package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/cjs/plugins/panel/styles.js +3 -1
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/cjs/plugins/rule/styles.js +3 -1
- package/dist/cjs/plugins/selection/utils.js +39 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +24 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -4
- package/dist/cjs/plugins/tasks-and-decisions/styles.js +3 -1
- package/dist/cjs/plugins/type-ahead/index.js +6 -2
- package/dist/cjs/plugins/unsupported-content/index.js +22 -10
- package/dist/cjs/plugins/unsupported-content/styles.js +4 -2
- package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +21 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +6 -3
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/cjs/ui/ChromeCollapsed/styles.js +3 -1
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +12 -1
- package/dist/es2019/create-editor/ReactEditorView.js +14 -6
- package/dist/es2019/create-editor/create-plugins-list.js +1 -2
- package/dist/es2019/editor.js +14 -0
- package/dist/es2019/event-dispatcher/index.js +8 -0
- package/dist/es2019/nodeviews/ReactNodeView.js +1 -10
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +9 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +138 -80
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +128 -0
- package/dist/es2019/plugins/card/styles.js +9 -5
- package/dist/es2019/plugins/code-block/styles.js +11 -8
- package/dist/es2019/plugins/collab-edit/plugin-state.js +23 -8
- package/dist/es2019/plugins/date/styles.js +3 -1
- package/dist/es2019/plugins/emoji/index.js +16 -21
- package/dist/es2019/plugins/emoji/nodeviews/emoji.js +12 -31
- package/dist/es2019/plugins/emoji/styles.js +1 -82
- package/dist/es2019/plugins/expand/ui/styles.js +2 -2
- package/dist/es2019/plugins/extension/ui/styles.js +4 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/es2019/plugins/layout/styles.js +3 -2
- package/dist/es2019/plugins/list/commands/indent-list.js +4 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +4 -1
- package/dist/es2019/plugins/list/transforms.js +9 -4
- package/dist/es2019/plugins/media/styles.js +9 -7
- package/dist/es2019/plugins/mentions/index.js +1 -6
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -35
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/es2019/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/es2019/plugins/panel/styles.js +5 -4
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/es2019/plugins/rule/styles.js +2 -1
- package/dist/es2019/plugins/selection/utils.js +35 -20
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +22 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +4 -0
- package/dist/es2019/plugins/table/ui/consts.js +5 -4
- package/dist/es2019/plugins/tasks-and-decisions/styles.js +4 -2
- package/dist/es2019/plugins/type-ahead/index.js +5 -1
- package/dist/es2019/plugins/unsupported-content/index.js +23 -12
- package/dist/es2019/plugins/unsupported-content/styles.js +5 -3
- package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +5 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -2
- package/dist/es2019/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/es2019/ui/ContentStyles/index.js +3 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +8 -0
- package/dist/esm/create-editor/ReactEditorView.js +14 -6
- package/dist/esm/create-editor/create-plugins-list.js +1 -2
- package/dist/esm/editor.js +14 -0
- package/dist/esm/event-dispatcher/index.js +9 -0
- package/dist/esm/nodeviews/ReactNodeView.js +1 -10
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +149 -0
- package/dist/esm/plugins/card/styles.js +2 -1
- package/dist/esm/plugins/code-block/styles.js +5 -4
- package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
- package/dist/esm/plugins/date/styles.js +2 -1
- package/dist/esm/plugins/emoji/index.js +26 -29
- package/dist/esm/plugins/emoji/nodeviews/emoji.js +11 -56
- package/dist/esm/plugins/emoji/styles.js +3 -14
- package/dist/esm/plugins/expand/ui/styles.js +2 -2
- package/dist/esm/plugins/extension/ui/styles.js +2 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/esm/plugins/layout/styles.js +2 -1
- package/dist/esm/plugins/list/commands/indent-list.js +4 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +4 -1
- package/dist/esm/plugins/list/transforms.js +9 -4
- package/dist/esm/plugins/media/styles.js +2 -1
- package/dist/esm/plugins/mentions/index.js +10 -14
- package/dist/esm/plugins/mentions/nodeviews/mention.js +13 -58
- package/dist/esm/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/esm/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/esm/plugins/panel/styles.js +2 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/esm/plugins/rule/styles.js +2 -1
- package/dist/esm/plugins/selection/utils.js +35 -20
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +23 -0
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +5 -4
- package/dist/esm/plugins/tasks-and-decisions/styles.js +2 -1
- package/dist/esm/plugins/type-ahead/index.js +6 -2
- package/dist/esm/plugins/unsupported-content/index.js +21 -11
- package/dist/esm/plugins/unsupported-content/styles.js +3 -2
- package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/esm/ui/Appearance/Chromeless.js +6 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/esm/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +3 -1
- package/dist/types/editor.d.ts +3 -0
- package/dist/types/event-dispatcher/index.d.ts +1 -0
- package/dist/types/nodeviews/ReactNodeView.d.ts +1 -5
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +10 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +44 -0
- package/dist/types/plugins/collab-edit/plugin-state.d.ts +4 -0
- package/dist/types/plugins/emoji/index.d.ts +2 -6
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +4 -14
- package/dist/types/plugins/emoji/styles.d.ts +0 -1
- package/dist/types/plugins/emoji/types.d.ts +0 -1
- package/dist/types/plugins/list/transforms.d.ts +10 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +6 -14
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +2 -5
- package/dist/types/plugins/selection/utils.d.ts +7 -15
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +3 -0
- package/dist/types/plugins/table/ui/consts.d.ts +2 -2
- package/dist/types/plugins/type-ahead/types.d.ts +1 -0
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +11 -0
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/editor-props.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +0 -14
- package/dist/types/ui/Appearance/Chromeless.d.ts +1 -0
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +4 -4
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +23 -23
- package/dist/cjs/plugins/emoji/nodeviews/emoji-next.js +0 -250
- package/dist/es2019/plugins/emoji/nodeviews/emoji-next.js +0 -177
- package/dist/esm/plugins/emoji/nodeviews/emoji-next.js +0 -234
- package/dist/types/plugins/emoji/nodeviews/emoji-next.d.ts +0 -31
|
@@ -18,8 +18,6 @@ var _main = require("../pm-plugins/main");
|
|
|
18
18
|
|
|
19
19
|
var _commands = require("../commands");
|
|
20
20
|
|
|
21
|
-
var _actions = require("../../card/pm-plugins/actions");
|
|
22
|
-
|
|
23
21
|
var _analytics = require("../../analytics");
|
|
24
22
|
|
|
25
23
|
var _analytics2 = require("../analytics");
|
|
@@ -77,13 +75,7 @@ var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(skipA
|
|
|
77
75
|
var markType = state.schema.mark('link', {
|
|
78
76
|
href: url
|
|
79
77
|
});
|
|
80
|
-
var tr = (
|
|
81
|
-
url: url,
|
|
82
|
-
pos: start,
|
|
83
|
-
appearance: 'inline',
|
|
84
|
-
compareLinkText: true,
|
|
85
|
-
source: _analytics.INPUT_METHOD.AUTO_DETECT
|
|
86
|
-
}])(state.tr.addMark(start, end, markType));
|
|
78
|
+
var tr = state.tr.addMark(start, end, markType);
|
|
87
79
|
|
|
88
80
|
if (dispatch) {
|
|
89
81
|
if (skipAnalytics) {
|
|
@@ -19,6 +19,8 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
19
19
|
|
|
20
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
21
|
|
|
22
|
+
var _tokens = require("@atlaskit/tokens");
|
|
23
|
+
|
|
22
24
|
var _types = require("../table/types");
|
|
23
25
|
|
|
24
26
|
var _consts = require("../table/ui/consts");
|
|
@@ -29,5 +31,5 @@ var LAYOUT_SECTION_MARGIN = (0, _constants.gridSize)();
|
|
|
29
31
|
exports.LAYOUT_SECTION_MARGIN = LAYOUT_SECTION_MARGIN;
|
|
30
32
|
var LAYOUT_COLUMN_PADDING = (0, _constants.gridSize)() * 1.5;
|
|
31
33
|
exports.LAYOUT_COLUMN_PADDING = LAYOUT_COLUMN_PADDING;
|
|
32
|
-
var layoutStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " [data-layout-section] {\n margin: ", "px -", "px 0;\n transition: border-color 0.3s ", ";\n cursor: pointer;\n\n /* Inner cursor located 26px from left */\n [data-layout-column] {\n flex: 1;\n min-width: 0;\n border: ", "px solid ", ";\n border-radius: 4px;\n padding: ", "px;\n box-sizing: border-box;\n\n > div {\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n .rich-media-item {\n margin-top: 0;\n }\n\n > .mediaSingleView-content-wrap:first-child .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child\n + span\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n > [data-node-type='decisionList'] {\n li:first-of-type [data-decision-wrapper] {\n margin-top: 0;\n }\n }\n }\n\n /* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n [data-layout-content] {\n height: 100%;\n cursor: text;\n }\n }\n\n [data-layout-column] + [data-layout-column] {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n [data-layout-column] + [data-layout-column] {\n margin-left: 0;\n }\n }\n\n /* Shows the border when cursor is inside a layout */\n &.selected [data-layout-column],\n &:hover [data-layout-column] {\n border-color: ", ";\n }\n\n &.selected.danger > [data-layout-column] {\n background-color: ", ";\n border-color: ", ";\n }\n\n &.", ":not(.danger) {\n [data-layout-column] {\n ", "\n }\n }\n }\n }\n\n .fabric-editor--full-width-mode .ProseMirror {\n [data-layout-section] {\n .", " {\n margin: 0 ", "px;\n }\n }\n }\n"])), _styles.columnLayoutSharedStyle, (0, _constants.gridSize)() - 1, _editorSharedStyles.akLayoutGutterOffset, _editorSharedStyles.akEditorSwoopCubicBezier, _editorSharedStyles.akEditorSelectedBorderSize, _colors.N40A, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN, _editorSharedStyles.gridMediumMaxWidth, _colors.N50A, _editorSharedStyles.akEditorDeleteBackground, _editorSharedStyles.akEditorDeleteBorder, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Border, _editorSharedStyles.SelectionStyle.Blanket]), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode);
|
|
34
|
+
var layoutStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " [data-layout-section] {\n margin: ", "px -", "px 0;\n transition: border-color 0.3s ", ";\n cursor: pointer;\n\n /* Inner cursor located 26px from left */\n [data-layout-column] {\n flex: 1;\n min-width: 0;\n border: ", "px solid ", ";\n border-radius: 4px;\n padding: ", "px;\n box-sizing: border-box;\n\n > div {\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n .rich-media-item {\n margin-top: 0;\n }\n\n > .mediaSingleView-content-wrap:first-child .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child\n + span\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n > [data-node-type='decisionList'] {\n li:first-of-type [data-decision-wrapper] {\n margin-top: 0;\n }\n }\n }\n\n /* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n [data-layout-content] {\n height: 100%;\n cursor: text;\n }\n }\n\n [data-layout-column] + [data-layout-column] {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n [data-layout-column] + [data-layout-column] {\n margin-left: 0;\n }\n }\n\n /* Shows the border when cursor is inside a layout */\n &.selected [data-layout-column],\n &:hover [data-layout-column] {\n border-color: ", ";\n }\n\n &.selected.danger > [data-layout-column] {\n background-color: ", ";\n border-color: ", ";\n }\n\n &.", ":not(.danger) {\n [data-layout-column] {\n ", "\n }\n }\n }\n }\n\n .fabric-editor--full-width-mode .ProseMirror {\n [data-layout-section] {\n .", " {\n margin: 0 ", "px;\n }\n }\n }\n"])), _styles.columnLayoutSharedStyle, (0, _constants.gridSize)() - 1, _editorSharedStyles.akLayoutGutterOffset, _editorSharedStyles.akEditorSwoopCubicBezier, _editorSharedStyles.akEditorSelectedBorderSize, _colors.N40A, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN, _editorSharedStyles.gridMediumMaxWidth, _colors.N50A, (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Border, _editorSharedStyles.SelectionStyle.Blanket]), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode);
|
|
33
35
|
exports.layoutStyles = layoutStyles;
|
|
@@ -25,6 +25,8 @@ var _selection = require("../utils/selection");
|
|
|
25
25
|
|
|
26
26
|
var _analytics2 = require("../utils/analytics");
|
|
27
27
|
|
|
28
|
+
var _prosemirrorHistory = require("prosemirror-history");
|
|
29
|
+
|
|
28
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
31
|
|
|
30
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -37,8 +39,10 @@ function indentList() {
|
|
|
37
39
|
|
|
38
40
|
if (!(0, _selection.isInsideListItem)(state)) {
|
|
39
41
|
return false;
|
|
40
|
-
}
|
|
42
|
+
} // Save the history, so it could undo/revert to the same state before the indent, see https://product-fabric.atlassian.net/browse/ED-14753
|
|
43
|
+
|
|
41
44
|
|
|
45
|
+
(0, _prosemirrorHistory.closeHistory)(tr);
|
|
42
46
|
var firstListItemSelectedAttributes = (0, _selection.getListItemAttributes)($from);
|
|
43
47
|
var parentListNode = (0, _find.findFirstParentListNode)($from);
|
|
44
48
|
|
|
@@ -21,6 +21,8 @@ var _analytics2 = require("../utils/analytics");
|
|
|
21
21
|
|
|
22
22
|
var _outdentListItemsSelected = require("../actions/outdent-list-items-selected");
|
|
23
23
|
|
|
24
|
+
var _prosemirrorHistory = require("prosemirror-history");
|
|
25
|
+
|
|
24
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
27
|
|
|
26
28
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -38,8 +40,10 @@ function outdentList() {
|
|
|
38
40
|
if (!parentListNode) {
|
|
39
41
|
// Even though this is a non-operation, we don't want to send this event to the browser. Because if we return false, the browser will move the focus to another place
|
|
40
42
|
return true;
|
|
41
|
-
}
|
|
43
|
+
} // Save the history, so it could undo/revert to the same state before the outdent, see https://product-fabric.atlassian.net/browse/ED-14753
|
|
44
|
+
|
|
42
45
|
|
|
46
|
+
(0, _prosemirrorHistory.closeHistory)(state.tr);
|
|
43
47
|
var actionSubjectId = (0, _node.isBulletList)(parentListNode.node) ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
44
48
|
var customTr = state.tr;
|
|
45
49
|
(0, _outdentListItemsSelected.outdentListItemsSelected)(customTr);
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.liftFollowingList = liftFollowingList;
|
|
9
9
|
exports.liftSelectionList = liftSelectionList;
|
|
10
|
-
exports.upgradeTextToLists = exports.splitParagraphs = void 0;
|
|
10
|
+
exports.upgradeTextToLists = exports.splitParagraphs = exports.splitIntoParagraphs = void 0;
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
@@ -263,8 +263,14 @@ var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
|
|
|
263
263
|
var _schema$nodes3 = schema.nodes,
|
|
264
264
|
hardBreak = _schema$nodes3.hardBreak,
|
|
265
265
|
paragraph = _schema$nodes3.paragraph;
|
|
266
|
-
fragment.forEach(function (node) {
|
|
267
|
-
|
|
266
|
+
fragment.forEach(function (node, i) {
|
|
267
|
+
// ED-14725 Fixed the issue that it make duplicated line
|
|
268
|
+
// when pasting <br /> from google docs.
|
|
269
|
+
if (i === 0 && node.type === hardBreak) {
|
|
270
|
+
paragraphs.push(paragraph.createChecked(undefined, curChildren, (0, _toConsumableArray2.default)(blockMarks)));
|
|
271
|
+
lastNode = node;
|
|
272
|
+
return;
|
|
273
|
+
} else if (lastNode && lastNode.type === hardBreak && node.type === hardBreak) {
|
|
268
274
|
// double hardbreak
|
|
269
275
|
// backtrack a little; remove the trailing hardbreak we added last loop
|
|
270
276
|
curChildren.pop(); // create a new paragraph
|
|
@@ -286,6 +292,8 @@ var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
|
|
|
286
292
|
return _prosemirrorModel.Fragment.from(paragraphs.length ? paragraphs : [paragraph.createAndFill(undefined, undefined, (0, _toConsumableArray2.default)(blockMarks))]);
|
|
287
293
|
};
|
|
288
294
|
|
|
295
|
+
exports.splitIntoParagraphs = splitIntoParagraphs;
|
|
296
|
+
|
|
289
297
|
var splitParagraphs = function splitParagraphs(slice, schema) {
|
|
290
298
|
// exclude Text nodes with a code mark, since we transform those later
|
|
291
299
|
// into a codeblock
|
|
@@ -19,9 +19,11 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
19
19
|
|
|
20
20
|
var _mediaCard = require("@atlaskit/media-card");
|
|
21
21
|
|
|
22
|
+
var _tokens = require("@atlaskit/tokens");
|
|
23
|
+
|
|
22
24
|
var _templateObject;
|
|
23
25
|
|
|
24
|
-
var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n .mediaGroupView-content-wrap.danger {\n /* Media inline */\n .", "::after {\n border: 1px solid ", ";\n }\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px
|
|
26
|
+
var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n .mediaGroupView-content-wrap.danger {\n /* Media inline */\n .", "::after {\n border: 1px solid ", ";\n }\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n /* Media resize handlers */\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: rgb(255, 189, 173, 0.5); /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n"])), _styles.mediaSingleSharedStyle, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _styles.richMediaClassName, _styles.richMediaClassName, _colors.N60, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _colors.B200, (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), _editorSharedStyles.akEditorSelectedBorderBoldSize, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _mediaCard.fileCardImageViewSelectedSelector, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteIconColor), _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteIconColor), _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteIconColor), _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteIconColor), (0, _tokens.token)('color.icon.danger', _editorSharedStyles.akEditorDeleteIconColor));
|
|
25
27
|
/* `left: unset` above is to work around Chrome bug where rendering a div with
|
|
26
28
|
* that style applied inside a container that has a scroll, causes any svgs on
|
|
27
29
|
* the page, without a border, that are inside a flexbox, to no longer align to
|
|
@@ -75,26 +75,22 @@ var mentionsPlugin = function mentionsPlugin(options) {
|
|
|
75
75
|
pmPlugins: function pmPlugins() {
|
|
76
76
|
return [{
|
|
77
77
|
name: 'mention',
|
|
78
|
-
plugin: function plugin(
|
|
79
|
-
|
|
80
|
-
dispatch = _ref.dispatch,
|
|
81
|
-
portalProviderAPI = _ref.portalProviderAPI,
|
|
82
|
-
eventDispatcher = _ref.eventDispatcher;
|
|
83
|
-
return (0, _main.createMentionPlugin)(dispatch, providerFactory, portalProviderAPI, eventDispatcher, fireEvent, options);
|
|
78
|
+
plugin: function plugin(pmPluginFactoryParams) {
|
|
79
|
+
return (0, _main.createMentionPlugin)(pmPluginFactoryParams, fireEvent, options);
|
|
84
80
|
}
|
|
85
81
|
}];
|
|
86
82
|
},
|
|
87
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
88
|
-
var editorView =
|
|
89
|
-
disabled =
|
|
83
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref) {
|
|
84
|
+
var editorView = _ref.editorView,
|
|
85
|
+
disabled = _ref.disabled;
|
|
90
86
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
91
87
|
editorView: editorView,
|
|
92
88
|
plugins: {
|
|
93
89
|
mentionState: _key.mentionPluginKey
|
|
94
90
|
},
|
|
95
|
-
render: function render(
|
|
96
|
-
var
|
|
97
|
-
mentionState =
|
|
91
|
+
render: function render(_ref2) {
|
|
92
|
+
var _ref2$mentionState = _ref2.mentionState,
|
|
93
|
+
mentionState = _ref2$mentionState === void 0 ? {} : _ref2$mentionState;
|
|
98
94
|
return !mentionState.mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
99
95
|
editorView: editorView,
|
|
100
96
|
isDisabled: disabled || (0, _utils.isTypeAheadAllowed)(editorView.state)
|
|
@@ -103,8 +99,8 @@ var mentionsPlugin = function mentionsPlugin(options) {
|
|
|
103
99
|
});
|
|
104
100
|
},
|
|
105
101
|
pluginsOptions: {
|
|
106
|
-
quickInsert: function quickInsert(
|
|
107
|
-
var formatMessage =
|
|
102
|
+
quickInsert: function quickInsert(_ref3) {
|
|
103
|
+
var formatMessage = _ref3.formatMessage;
|
|
108
104
|
return [{
|
|
109
105
|
id: 'mention',
|
|
110
106
|
title: formatMessage(_messages.messages.mention),
|
|
@@ -6,75 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.MentionNodeView = void 0;
|
|
9
|
-
exports.default = mentionNodeView;
|
|
10
|
-
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
|
|
13
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
-
|
|
15
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
16
|
-
|
|
17
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
18
|
-
|
|
19
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
20
|
-
|
|
21
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
22
9
|
|
|
23
10
|
var _react = _interopRequireDefault(require("react"));
|
|
24
11
|
|
|
25
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
26
|
-
|
|
27
12
|
var _Mention = _interopRequireDefault(require("../ui/Mention"));
|
|
28
13
|
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(0, _createClass2.default)(MentionNodeView, [{
|
|
46
|
-
key: "createDomRef",
|
|
47
|
-
value: function createDomRef() {
|
|
48
|
-
return (0, _get2.default)((0, _getPrototypeOf2.default)(MentionNodeView.prototype), "createDomRef", this).call(this);
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "render",
|
|
52
|
-
value: function render(props) {
|
|
53
|
-
var providerFactory = props.providerFactory,
|
|
54
|
-
options = props.options;
|
|
55
|
-
var _this$node$attrs = this.node.attrs,
|
|
56
|
-
id = _this$node$attrs.id,
|
|
57
|
-
text = _this$node$attrs.text,
|
|
58
|
-
accessLevel = _this$node$attrs.accessLevel;
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Mention.default, {
|
|
60
|
-
id: id,
|
|
61
|
-
text: text,
|
|
62
|
-
accessLevel: accessLevel,
|
|
63
|
-
providers: providerFactory
|
|
64
|
-
}), options && options.allowZeroWidthSpaceAfter && _utils.ZERO_WIDTH_SPACE);
|
|
65
|
-
}
|
|
66
|
-
}]);
|
|
67
|
-
return MentionNodeView;
|
|
68
|
-
}(_nodeviews.ReactNodeView);
|
|
69
|
-
|
|
70
|
-
exports.MentionNodeView = MentionNodeView;
|
|
71
|
-
|
|
72
|
-
function mentionNodeView(portalProviderAPI, eventDispatcher, providerFactory, options) {
|
|
73
|
-
return function (node, view, getPos) {
|
|
74
|
-
var hasIntlContext = true;
|
|
75
|
-
return new MentionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
76
|
-
providerFactory: providerFactory,
|
|
77
|
-
options: options
|
|
78
|
-
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
79
|
-
};
|
|
80
|
-
}
|
|
14
|
+
var MentionNodeView = function MentionNodeView(props) {
|
|
15
|
+
var providerFactory = props.providerFactory;
|
|
16
|
+
var _props$node$attrs = props.node.attrs,
|
|
17
|
+
id = _props$node$attrs.id,
|
|
18
|
+
text = _props$node$attrs.text,
|
|
19
|
+
accessLevel = _props$node$attrs.accessLevel;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_Mention.default, {
|
|
21
|
+
id: id,
|
|
22
|
+
text: text,
|
|
23
|
+
accessLevel: accessLevel,
|
|
24
|
+
providers: providerFactory
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.MentionNodeView = MentionNodeView;
|
|
@@ -14,7 +14,9 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
14
14
|
|
|
15
15
|
var _resource = require("@atlaskit/mention/resource");
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _getInlineNodeViewProducer = require("../../../nodeviews/getInlineNodeViewProducer");
|
|
18
|
+
|
|
19
|
+
var _mention = require("../nodeviews/mention");
|
|
18
20
|
|
|
19
21
|
var _key = require("./key");
|
|
20
22
|
|
|
@@ -59,7 +61,7 @@ var setContext = function setContext(context) {
|
|
|
59
61
|
|
|
60
62
|
exports.setContext = setContext;
|
|
61
63
|
|
|
62
|
-
function createMentionPlugin(
|
|
64
|
+
function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
63
65
|
var mentionProvider;
|
|
64
66
|
|
|
65
67
|
var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes) {
|
|
@@ -89,14 +91,14 @@ function createMentionPlugin(dispatch, providerFactory, portalProviderAPI, event
|
|
|
89
91
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
90
92
|
mentionProvider: params.provider
|
|
91
93
|
});
|
|
92
|
-
dispatch(_key.mentionPluginKey, newPluginState);
|
|
94
|
+
pmPluginFactoryParams.dispatch(_key.mentionPluginKey, newPluginState);
|
|
93
95
|
return newPluginState;
|
|
94
96
|
|
|
95
97
|
case ACTIONS.SET_CONTEXT:
|
|
96
98
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
97
99
|
contextIdentifierProvider: params.context
|
|
98
100
|
});
|
|
99
|
-
dispatch(_key.mentionPluginKey, newPluginState);
|
|
101
|
+
pmPluginFactoryParams.dispatch(_key.mentionPluginKey, newPluginState);
|
|
100
102
|
return newPluginState;
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -105,7 +107,14 @@ function createMentionPlugin(dispatch, providerFactory, portalProviderAPI, event
|
|
|
105
107
|
},
|
|
106
108
|
props: {
|
|
107
109
|
nodeViews: {
|
|
108
|
-
mention: (0,
|
|
110
|
+
mention: (0, _getInlineNodeViewProducer.getInlineNodeViewProducer)({
|
|
111
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
112
|
+
Component: _mention.MentionNodeView,
|
|
113
|
+
extraComponentProps: {
|
|
114
|
+
providerFactory: pmPluginFactoryParams.providerFactory,
|
|
115
|
+
options: options
|
|
116
|
+
}
|
|
117
|
+
})
|
|
109
118
|
}
|
|
110
119
|
},
|
|
111
120
|
view: function view(editorView) {
|
|
@@ -143,13 +152,13 @@ function createMentionPlugin(dispatch, providerFactory, portalProviderAPI, event
|
|
|
143
152
|
return;
|
|
144
153
|
};
|
|
145
154
|
|
|
146
|
-
providerFactory.subscribe('mentionProvider', providerHandler);
|
|
147
|
-
providerFactory.subscribe('contextIdentifierProvider', providerHandler);
|
|
155
|
+
pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
|
|
156
|
+
pmPluginFactoryParams.providerFactory.subscribe('contextIdentifierProvider', providerHandler);
|
|
148
157
|
return {
|
|
149
158
|
destroy: function destroy() {
|
|
150
|
-
if (providerFactory) {
|
|
151
|
-
providerFactory.unsubscribe('mentionProvider', providerHandler);
|
|
152
|
-
providerFactory.unsubscribe('contextIdentifierProvider', providerHandler);
|
|
159
|
+
if (pmPluginFactoryParams.providerFactory) {
|
|
160
|
+
pmPluginFactoryParams.providerFactory.unsubscribe('mentionProvider', providerHandler);
|
|
161
|
+
pmPluginFactoryParams.providerFactory.unsubscribe('contextIdentifierProvider', providerHandler);
|
|
153
162
|
}
|
|
154
163
|
|
|
155
164
|
if (mentionProvider) {
|
|
@@ -411,10 +411,15 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
411
411
|
dismiss: function dismiss(_ref9) {
|
|
412
412
|
var editorState = _ref9.editorState,
|
|
413
413
|
query = _ref9.query,
|
|
414
|
-
stats = _ref9.stats
|
|
414
|
+
stats = _ref9.stats,
|
|
415
|
+
wasItemInserted = _ref9.wasItemInserted;
|
|
415
416
|
firstQueryWithoutResults = null;
|
|
416
417
|
var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
|
|
417
|
-
|
|
418
|
+
|
|
419
|
+
if (!wasItemInserted) {
|
|
420
|
+
fireEvent((0, _analytics.buildTypeAheadCancelPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
|
|
421
|
+
}
|
|
422
|
+
|
|
418
423
|
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
419
424
|
|
|
420
425
|
if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
|
|
@@ -15,10 +15,12 @@ var _panel = require("@atlaskit/editor-common/panel");
|
|
|
15
15
|
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
17
|
|
|
18
|
+
var _tokens = require("@atlaskit/tokens");
|
|
19
|
+
|
|
18
20
|
var _templateObject;
|
|
19
21
|
|
|
20
22
|
var panelStyles = function panelStyles(props) {
|
|
21
|
-
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .", " {\n cursor: pointer;\n\n /* Danger when top level node */\n &.danger {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", " !important;\n\n .", " {\n color: ", " !important;\n }\n }\n }\n\n .", " {\n cursor: text;\n }\n\n /* Danger when nested node */\n .danger .", " {\n &[data-panel-type] {\n background-color: ", ";\n\n .", " {\n color: ", ";\n }\n }\n }\n\n ", ";\n }\n\n .", ".", ":not(.danger) {\n ", "\n }\n"])), _panel.PanelSharedCssClassName.prefix, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, _editorSharedStyles.akEditorDeleteBackground, _panel.PanelSharedCssClassName.icon, _editorSharedStyles.akEditorDeleteIconColor, _panel.PanelSharedCssClassName.content, _panel.PanelSharedCssClassName.prefix, _editorSharedStyles.akEditorDeleteBackgroundWithOpacity, _panel.PanelSharedCssClassName.icon, _editorSharedStyles.akEditorDeleteIconColor, (0, _panel.panelSharedStyles)(props), _panel.PanelSharedCssClassName.prefix, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]));
|
|
23
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .", " {\n cursor: pointer;\n\n /* Danger when top level node */\n &.danger {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", " !important;\n\n .", " {\n color: ", " !important;\n }\n }\n }\n\n .", " {\n cursor: text;\n }\n\n /* Danger when nested node */\n .danger .", " {\n &[data-panel-type] {\n background-color: ", ";\n\n .", " {\n color: ", ";\n }\n }\n }\n\n ", ";\n }\n\n .", ".", ":not(.danger) {\n ", "\n }\n"])), _panel.PanelSharedCssClassName.prefix, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), _panel.PanelSharedCssClassName.icon, (0, _tokens.token)('color.icon.danger', _editorSharedStyles.akEditorDeleteIconColor), _panel.PanelSharedCssClassName.content, _panel.PanelSharedCssClassName.prefix, (0, _tokens.token)('color.blanket.danger', _editorSharedStyles.akEditorDeleteBackgroundWithOpacity), _panel.PanelSharedCssClassName.icon, (0, _tokens.token)('color.icon.danger', _editorSharedStyles.akEditorDeleteIconColor), (0, _panel.panelSharedStyles)(props), _panel.PanelSharedCssClassName.prefix, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]));
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
exports.panelStyles = panelStyles;
|
|
@@ -17,7 +17,9 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
17
17
|
|
|
18
18
|
var serializePlaceholderNode = function serializePlaceholderNode(node) {
|
|
19
19
|
var element = document.createElement('span');
|
|
20
|
-
element.classList.add('pm-placeholder');
|
|
20
|
+
element.classList.add('pm-placeholder'); // the inline node api test suite requires the following class name
|
|
21
|
+
|
|
22
|
+
element.classList.add('placeholderView-content-wrap');
|
|
21
23
|
|
|
22
24
|
if (_utils.browser.gecko) {
|
|
23
25
|
element.setAttribute('contenteditable', 'true');
|
|
@@ -15,10 +15,12 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
15
15
|
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
17
|
|
|
18
|
+
var _tokens = require("@atlaskit/tokens");
|
|
19
|
+
|
|
18
20
|
var _templateObject;
|
|
19
21
|
|
|
20
22
|
var ruleStyles = function ruleStyles(props) {
|
|
21
|
-
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", ";\n\n hr {\n cursor: pointer;\n padding: 4px 0;\n margin: calc(", "em - 4px) 0;\n background-clip: content-box;\n\n &.", " {\n outline: none;\n background-color: ", ";\n }\n }\n }\n"])), (0, _styles.ruleSharedStyles)(props), _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedBorderColor);
|
|
23
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", ";\n\n hr {\n cursor: pointer;\n padding: 4px 0;\n margin: calc(", "em - 4px) 0;\n background-clip: content-box;\n\n &.", " {\n outline: none;\n background-color: ", ";\n }\n }\n }\n"])), (0, _styles.ruleSharedStyles)(props), _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _tokens.token)('color.border.selected', _editorSharedStyles.akEditorSelectedBorderColor));
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
exports.ruleStyles = ruleStyles;
|
|
@@ -9,8 +9,9 @@ exports.getAllSelectionAnalyticsPayload = getAllSelectionAnalyticsPayload;
|
|
|
9
9
|
exports.getCellSelectionAnalyticsPayload = getCellSelectionAnalyticsPayload;
|
|
10
10
|
exports.getDecorations = void 0;
|
|
11
11
|
exports.getNodeSelectionAnalyticsPayload = getNodeSelectionAnalyticsPayload;
|
|
12
|
+
exports.getNodesToDecorateFromSelection = void 0;
|
|
12
13
|
exports.getRangeSelectionAnalyticsPayload = getRangeSelectionAnalyticsPayload;
|
|
13
|
-
exports.isSelectionAtStartOfParentNode = exports.isSelectionAtEndOfParentNode = exports.isSelectableContainerNode = exports.isSelectableChildNode =
|
|
14
|
+
exports.isSelectionAtStartOfParentNode = exports.isSelectionAtEndOfParentNode = exports.isSelectableContainerNode = exports.isSelectableChildNode = void 0;
|
|
14
15
|
exports.shouldRecalcDecorations = shouldRecalcDecorations;
|
|
15
16
|
|
|
16
17
|
var _prosemirrorState = require("prosemirror-state");
|
|
@@ -67,7 +68,7 @@ var getDecorations = function getDecorations(tr) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
if (tr.selection instanceof _prosemirrorState.TextSelection || tr.selection instanceof _prosemirrorState.AllSelection) {
|
|
70
|
-
var decorations =
|
|
71
|
+
var decorations = getNodesToDecorateFromSelection(tr.selection, tr.doc).map(function (_ref) {
|
|
71
72
|
var node = _ref.node,
|
|
72
73
|
pos = _ref.pos;
|
|
73
74
|
return _prosemirrorView.Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -124,39 +125,54 @@ function getCellSelectionAnalyticsPayload(state) {
|
|
|
124
125
|
};
|
|
125
126
|
}
|
|
126
127
|
}
|
|
128
|
+
|
|
129
|
+
var topLevelBlockNodesThatHaveSelectionStyles = ['table', 'panel', 'expand', 'layoutSection', 'decisionList', 'decisionItem', 'codeBlock'];
|
|
127
130
|
/**
|
|
128
|
-
* Use `
|
|
129
|
-
* a list of
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* For example, using the following document:
|
|
135
|
-
* ```
|
|
136
|
-
* doc(p('{<}one'), blockquote(p('hello')), p(expand({ title: 'two' })(p('three'))), p('four{>}'))))
|
|
137
|
-
* ```
|
|
138
|
-
* we would expect `getTopLevelNodesFromSelection` to return:
|
|
139
|
-
* ```
|
|
140
|
-
* [blockquote(p('hello')), expand({ title: 'two' })(p('three')))]
|
|
141
|
-
* ```
|
|
131
|
+
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
132
|
+
* a list of nodes within the Selection that should have Selection
|
|
133
|
+
* decorations applied. This allows selection styles to be added to
|
|
134
|
+
* nested nodes. It will ignore text nodes as decorations are
|
|
135
|
+
* applied natively and also ignore nodes that don't completely
|
|
136
|
+
* sit within the given `Selection`.
|
|
142
137
|
*/
|
|
143
138
|
|
|
144
|
-
|
|
145
|
-
var getTopLevelNodesFromSelection = function getTopLevelNodesFromSelection(selection, doc) {
|
|
139
|
+
var getNodesToDecorateFromSelection = function getNodesToDecorateFromSelection(selection, doc) {
|
|
146
140
|
var nodes = [];
|
|
147
141
|
|
|
148
142
|
if (selection.from !== selection.to) {
|
|
149
143
|
var from = selection.from,
|
|
150
144
|
to = selection.to;
|
|
151
145
|
doc.nodesBetween(from, to, function (node, pos) {
|
|
152
|
-
var withinSelection = from <= pos && pos + node.nodeSize <= to;
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
var withinSelection = from <= pos && pos + node.nodeSize <= to; // The reason we need to check for these nodes is to stop
|
|
147
|
+
// traversing their children if they are within a selection -
|
|
148
|
+
// this is to prevent selection styles from being added to
|
|
149
|
+
// the children as well as the parent node.
|
|
150
|
+
// Example scenario is if an entire table has been selected
|
|
151
|
+
// we should not traverse its children so we can apply the
|
|
152
|
+
// selection styles to the table. But if an entire tableRow
|
|
153
|
+
// has been selected (but the parent table has not) we should
|
|
154
|
+
// traverse it as it could contain other nodes that need
|
|
155
|
+
// selection styles. I couldn’t see a clear way to differentiate
|
|
156
|
+
// without explicitly stating which nodes should be traversed
|
|
157
|
+
// and which shouldn’t.
|
|
158
|
+
|
|
159
|
+
var isTopLevelNodeThatHasSelectionStyles = topLevelBlockNodesThatHaveSelectionStyles.includes(node.type.name); // If the node is a top-level block node and completely sits within
|
|
160
|
+
// the selection, we do not recurse it's children to prevent selection
|
|
161
|
+
// styles being added to its child nodes. The expected behaviour
|
|
162
|
+
// is that selection styles are only added to the parent.
|
|
163
|
+
|
|
164
|
+
if (node && withinSelection && isTopLevelNodeThatHasSelectionStyles) {
|
|
165
|
+
nodes.push({
|
|
166
|
+
node: node,
|
|
167
|
+
pos: pos
|
|
168
|
+
});
|
|
169
|
+
return false; // Otherwise we recurse the children and return them so we can apply
|
|
170
|
+
// selection styles. Text is handled by the browser.
|
|
171
|
+
} else if (node && withinSelection && !node.isText) {
|
|
155
172
|
nodes.push({
|
|
156
173
|
node: node,
|
|
157
174
|
pos: pos
|
|
158
175
|
});
|
|
159
|
-
return false;
|
|
160
176
|
}
|
|
161
177
|
|
|
162
178
|
return true;
|
|
@@ -166,7 +182,7 @@ var getTopLevelNodesFromSelection = function getTopLevelNodesFromSelection(selec
|
|
|
166
182
|
return nodes;
|
|
167
183
|
};
|
|
168
184
|
|
|
169
|
-
exports.
|
|
185
|
+
exports.getNodesToDecorateFromSelection = getNodesToDecorateFromSelection;
|
|
170
186
|
|
|
171
187
|
function getRangeSelectionAnalyticsPayload(selection, doc) {
|
|
172
188
|
if (selection instanceof _prosemirrorState.TextSelection && selection.from !== selection.to) {
|
|
@@ -33,6 +33,16 @@ var _dom2 = require("./dom");
|
|
|
33
33
|
|
|
34
34
|
var _featureFlagsContext = require("../../../../feature-flags-context");
|
|
35
35
|
|
|
36
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
37
|
+
|
|
38
|
+
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
39
|
+
|
|
40
|
+
// limit scroll event calls
|
|
41
|
+
var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200; // timeout for resetting the scroll class - if it’s too long then users won’t be able to click on the header cells,
|
|
42
|
+
// if too short it would trigger too many dom udpates.
|
|
43
|
+
|
|
44
|
+
var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
45
|
+
|
|
36
46
|
var supportedHeaderRow = function supportedHeaderRow(node) {
|
|
37
47
|
var allHeaders = (0, _slice.mapChildren)(node, function (child) {
|
|
38
48
|
return child.type.name === 'tableHeader';
|
|
@@ -58,6 +68,16 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
58
68
|
(0, _defineProperty2.default)(this, "stickyHeadersOptimization", false);
|
|
59
69
|
(0, _defineProperty2.default)(this, "sentinels", {});
|
|
60
70
|
(0, _defineProperty2.default)(this, "listening", false);
|
|
71
|
+
(0, _defineProperty2.default)(this, "headerRowMouseScrollEnd", (0, _debounce.default)(function () {
|
|
72
|
+
_this.dom.classList.remove('no-pointer-events');
|
|
73
|
+
}, HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT));
|
|
74
|
+
(0, _defineProperty2.default)(this, "headerRowMouseScroll", (0, _throttle.default)(function () {
|
|
75
|
+
if (_this.isSticky) {
|
|
76
|
+
_this.dom.classList.add('no-pointer-events');
|
|
77
|
+
|
|
78
|
+
_this.headerRowMouseScrollEnd();
|
|
79
|
+
}
|
|
80
|
+
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
61
81
|
(0, _defineProperty2.default)(this, "onScroll", function () {
|
|
62
82
|
if (!_this.tree) {
|
|
63
83
|
return;
|
|
@@ -352,6 +372,8 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
352
372
|
this.eventDispatcher.on(_width.pluginKey.key, this.onWidthPluginState);
|
|
353
373
|
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
354
374
|
this.listening = true;
|
|
375
|
+
this.dom.addEventListener('wheel', this.headerRowMouseScroll.bind(this));
|
|
376
|
+
this.dom.addEventListener('touchmove', this.headerRowMouseScroll.bind(this));
|
|
355
377
|
}
|
|
356
378
|
}, {
|
|
357
379
|
key: "unsubscribe",
|
|
@@ -375,6 +397,8 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
375
397
|
this.eventDispatcher.off(_width.pluginKey.key, this.onWidthPluginState);
|
|
376
398
|
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
377
399
|
this.listening = false;
|
|
400
|
+
this.dom.removeEventListener('wheel', this.headerRowMouseScroll);
|
|
401
|
+
this.dom.removeEventListener('touchmove', this.headerRowMouseScroll);
|
|
378
402
|
} // initialize intersection observer to track if table is within scroll area
|
|
379
403
|
|
|
380
404
|
}, {
|