@atlaskit/editor-core 165.0.0 → 166.0.2
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/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -2
- 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/index.js +2 -2
- package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
- package/dist/cjs/plugins/collab-edit/provider/channel.js +2 -2
- 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/context-panel.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/main.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/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- 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/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
- 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/macro/actions.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/styles.js +3 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- 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/event-handlers.js +3 -3
- 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/text-formatting/utils.js +1 -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/ConfigPanel/ConfigPanel.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +2 -2
- package/dist/cjs/ui/ConfigPanel/transformers.js +2 -2
- 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/text-formatting/utils.js +1 -1
- 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 +9 -1
- package/dist/esm/create-editor/ErrorBoundary.js +1 -1
- 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 +16 -1
- 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/annotation/pm-plugins/inline-comment.js +1 -1
- 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/index.js +1 -1
- package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
- package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
- package/dist/esm/plugins/custom-autoformat/index.js +1 -1
- 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/actions.js +1 -1
- package/dist/esm/plugins/extension/context-panel.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +1 -1
- 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/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +1 -1
- package/dist/esm/plugins/find-replace/utils/batch-decorations.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
- 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/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -1
- package/dist/esm/plugins/image-upload/pm-plugins/main.js +1 -1
- 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/macro/actions.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/picker-facade.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/media/styles.js +2 -1
- package/dist/esm/plugins/media/toolbar/utils.js +1 -1
- package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +1 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +1 -1
- package/dist/esm/plugins/media/utils/check-media-type.js +1 -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/paste/handlers.js +1 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/esm/plugins/quick-insert/index.js +1 -1
- package/dist/esm/plugins/rule/styles.js +2 -1
- package/dist/esm/plugins/selection/utils.js +35 -20
- package/dist/esm/plugins/table/event-handlers.js +3 -3
- 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/tasks-and-decisions/ui/Task/task-item-with-providers.js +1 -1
- package/dist/esm/plugins/text-formatting/utils.js +1 -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/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +1 -1
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +1 -1
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +1 -1
- package/dist/esm/ui/ConfigPanel/transformers.js +1 -1
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/ui/LinkSearch/index.js +1 -1
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/utils/action.js +1 -1
- package/dist/esm/utils/clipboard.js +1 -1
- package/dist/esm/utils/extensions.js +1 -1
- 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
|
@@ -230,7 +230,7 @@ var extractListFromParagraph = function extractListFromParagraph(node, parent, s
|
|
|
230
230
|
*/
|
|
231
231
|
|
|
232
232
|
|
|
233
|
-
var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
|
|
233
|
+
export var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
|
|
234
234
|
var fragment = _ref.fragment,
|
|
235
235
|
_ref$blockMarks = _ref.blockMarks,
|
|
236
236
|
blockMarks = _ref$blockMarks === void 0 ? [] : _ref$blockMarks,
|
|
@@ -241,8 +241,14 @@ var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
|
|
|
241
241
|
var _schema$nodes3 = schema.nodes,
|
|
242
242
|
hardBreak = _schema$nodes3.hardBreak,
|
|
243
243
|
paragraph = _schema$nodes3.paragraph;
|
|
244
|
-
fragment.forEach(function (node) {
|
|
245
|
-
|
|
244
|
+
fragment.forEach(function (node, i) {
|
|
245
|
+
// ED-14725 Fixed the issue that it make duplicated line
|
|
246
|
+
// when pasting <br /> from google docs.
|
|
247
|
+
if (i === 0 && node.type === hardBreak) {
|
|
248
|
+
paragraphs.push(paragraph.createChecked(undefined, curChildren, _toConsumableArray(blockMarks)));
|
|
249
|
+
lastNode = node;
|
|
250
|
+
return;
|
|
251
|
+
} else if (lastNode && lastNode.type === hardBreak && node.type === hardBreak) {
|
|
246
252
|
// double hardbreak
|
|
247
253
|
// backtrack a little; remove the trailing hardbreak we added last loop
|
|
248
254
|
curChildren.pop(); // create a new paragraph
|
|
@@ -263,7 +269,6 @@ var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
|
|
|
263
269
|
|
|
264
270
|
return Fragment.from(paragraphs.length ? paragraphs : [paragraph.createAndFill(undefined, undefined, _toConsumableArray(blockMarks))]);
|
|
265
271
|
};
|
|
266
|
-
|
|
267
272
|
export var splitParagraphs = function splitParagraphs(slice, schema) {
|
|
268
273
|
// exclude Text nodes with a code mark, since we transform those later
|
|
269
274
|
// into a codeblock
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
3
|
|
|
5
4
|
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; }
|
|
6
5
|
|
|
7
6
|
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) { _defineProperty(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; }
|
|
8
7
|
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
9
|
import assert from 'assert';
|
|
10
10
|
import { Selection, NodeSelection, TextSelection } from 'prosemirror-state';
|
|
11
11
|
import { safeInsert, replaceSelectedNode, findSelectedNodeOfType, replaceParentNodeOfType } from 'prosemirror-utils';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -7,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
|
|
11
11
|
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; }
|
|
12
12
|
|
|
@@ -5,7 +5,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
8
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
8
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
10
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
10
|
|
|
@@ -13,6 +12,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
13
12
|
|
|
14
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
14
|
|
|
15
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
16
|
+
|
|
16
17
|
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; }
|
|
17
18
|
|
|
18
19
|
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) { _defineProperty(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; }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import uuidV4 from 'uuid/v4';
|
|
7
7
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { getMediaClient, isMediaBlobUrl as _isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -7,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
12
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _get from "@babel/runtime/helpers/get";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -9,6 +8,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
9
8
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
10
9
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
11
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
12
|
|
|
13
13
|
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; }
|
|
14
14
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import { isImagePreview } from '@atlaskit/media-picker';
|
|
7
7
|
|
|
8
8
|
var PickerFacade = /*#__PURE__*/function () {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -14,6 +13,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
14
13
|
|
|
15
14
|
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) { _defineProperty(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; }
|
|
16
15
|
|
|
16
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import ReactDOM from 'react-dom';
|
|
19
19
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -7,7 +7,8 @@ import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-com
|
|
|
7
7
|
import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { N60, B200 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { fileCardImageViewSelector, fileCardImageViewSelectedSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
|
|
10
|
-
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
export var mediaStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])), mediaSingleSharedStyle, richMediaClassName, richMediaClassName, richMediaClassName, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPadding, richMediaClassName, richMediaClassName, N60, akEditorSelectedNodeClassName, akEditorSelectedNodeClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, B200, token('color.background.danger', akEditorDeleteBackground), akEditorSelectedBorderBoldSize, token('color.border.danger', akEditorDeleteBorder), fileCardImageViewSelectedSelector, token('color.border.danger', akEditorDeleteIconColor), richMediaClassName, fileCardImageViewSelector, token('color.border.danger', akEditorDeleteIconColor), richMediaClassName, inlinePlayerClassName, token('color.border.danger', akEditorDeleteIconColor), richMediaClassName, newFileExperienceClassName, token('color.border.danger', akEditorDeleteIconColor), token('color.icon.danger', akEditorDeleteIconColor));
|
|
11
12
|
/* `left: unset` above is to work around Chrome bug where rendering a div with
|
|
12
13
|
* that style applied inside a container that has a scroll, causes any svgs on
|
|
13
14
|
* the page, without a border, that are inside a flexbox, to no longer align to
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
4
4
|
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from 'prosemirror-utils';
|
|
5
5
|
export var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeAttrs(mediaPluginState) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -7,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
12
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -8,6 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
8
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
11
|
|
|
12
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
4
4
|
export var checkMediaType = /*#__PURE__*/function () {
|
|
5
5
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaNode, mediaClientConfig) {
|
|
@@ -48,26 +48,22 @@ var mentionsPlugin = function mentionsPlugin(options) {
|
|
|
48
48
|
pmPlugins: function pmPlugins() {
|
|
49
49
|
return [{
|
|
50
50
|
name: 'mention',
|
|
51
|
-
plugin: function plugin(
|
|
52
|
-
|
|
53
|
-
dispatch = _ref.dispatch,
|
|
54
|
-
portalProviderAPI = _ref.portalProviderAPI,
|
|
55
|
-
eventDispatcher = _ref.eventDispatcher;
|
|
56
|
-
return createMentionPlugin(dispatch, providerFactory, portalProviderAPI, eventDispatcher, fireEvent, options);
|
|
51
|
+
plugin: function plugin(pmPluginFactoryParams) {
|
|
52
|
+
return createMentionPlugin(pmPluginFactoryParams, fireEvent, options);
|
|
57
53
|
}
|
|
58
54
|
}];
|
|
59
55
|
},
|
|
60
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
61
|
-
var editorView =
|
|
62
|
-
disabled =
|
|
56
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref) {
|
|
57
|
+
var editorView = _ref.editorView,
|
|
58
|
+
disabled = _ref.disabled;
|
|
63
59
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
64
60
|
editorView: editorView,
|
|
65
61
|
plugins: {
|
|
66
62
|
mentionState: mentionPluginKey
|
|
67
63
|
},
|
|
68
|
-
render: function render(
|
|
69
|
-
var
|
|
70
|
-
mentionState =
|
|
64
|
+
render: function render(_ref2) {
|
|
65
|
+
var _ref2$mentionState = _ref2.mentionState,
|
|
66
|
+
mentionState = _ref2$mentionState === void 0 ? {} : _ref2$mentionState;
|
|
71
67
|
return !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
72
68
|
editorView: editorView,
|
|
73
69
|
isDisabled: disabled || isTypeAheadAllowed(editorView.state)
|
|
@@ -76,8 +72,8 @@ var mentionsPlugin = function mentionsPlugin(options) {
|
|
|
76
72
|
});
|
|
77
73
|
},
|
|
78
74
|
pluginsOptions: {
|
|
79
|
-
quickInsert: function quickInsert(
|
|
80
|
-
var formatMessage =
|
|
75
|
+
quickInsert: function quickInsert(_ref3) {
|
|
76
|
+
var formatMessage = _ref3.formatMessage;
|
|
81
77
|
return [{
|
|
82
78
|
id: 'mention',
|
|
83
79
|
title: formatMessage(messages.mention),
|
|
@@ -1,60 +1,15 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _get from "@babel/runtime/helpers/get";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
|
|
12
1
|
import React from 'react';
|
|
13
|
-
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
14
2
|
import Mention from '../ui/Mention';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
key: "createDomRef",
|
|
29
|
-
value: function createDomRef() {
|
|
30
|
-
return _get(_getPrototypeOf(MentionNodeView.prototype), "createDomRef", this).call(this);
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "render",
|
|
34
|
-
value: function render(props) {
|
|
35
|
-
var providerFactory = props.providerFactory,
|
|
36
|
-
options = props.options;
|
|
37
|
-
var _this$node$attrs = this.node.attrs,
|
|
38
|
-
id = _this$node$attrs.id,
|
|
39
|
-
text = _this$node$attrs.text,
|
|
40
|
-
accessLevel = _this$node$attrs.accessLevel;
|
|
41
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Mention, {
|
|
42
|
-
id: id,
|
|
43
|
-
text: text,
|
|
44
|
-
accessLevel: accessLevel,
|
|
45
|
-
providers: providerFactory
|
|
46
|
-
}), options && options.allowZeroWidthSpaceAfter && ZERO_WIDTH_SPACE);
|
|
47
|
-
}
|
|
48
|
-
}]);
|
|
49
|
-
|
|
50
|
-
return MentionNodeView;
|
|
51
|
-
}(ReactNodeView);
|
|
52
|
-
export default function mentionNodeView(portalProviderAPI, eventDispatcher, providerFactory, options) {
|
|
53
|
-
return function (node, view, getPos) {
|
|
54
|
-
var hasIntlContext = true;
|
|
55
|
-
return new MentionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
56
|
-
providerFactory: providerFactory,
|
|
57
|
-
options: options
|
|
58
|
-
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
59
|
-
};
|
|
60
|
-
}
|
|
3
|
+
export var MentionNodeView = function MentionNodeView(props) {
|
|
4
|
+
var providerFactory = props.providerFactory;
|
|
5
|
+
var _props$node$attrs = props.node.attrs,
|
|
6
|
+
id = _props$node$attrs.id,
|
|
7
|
+
text = _props$node$attrs.text,
|
|
8
|
+
accessLevel = _props$node$attrs.accessLevel;
|
|
9
|
+
return /*#__PURE__*/React.createElement(Mention, {
|
|
10
|
+
id: id,
|
|
11
|
+
text: text,
|
|
12
|
+
accessLevel: accessLevel,
|
|
13
|
+
providers: providerFactory
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -6,7 +6,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
8
|
import { SLI_EVENT_TYPE, SMART_EVENT_TYPE, buildSliPayload } from '@atlaskit/mention/resource';
|
|
9
|
-
import
|
|
9
|
+
import { getInlineNodeViewProducer } from '../../../nodeviews/getInlineNodeViewProducer';
|
|
10
|
+
import { MentionNodeView } from '../nodeviews/mention';
|
|
10
11
|
import { mentionPluginKey } from './key';
|
|
11
12
|
var ACTIONS = {
|
|
12
13
|
SET_PROVIDER: 'SET_PROVIDER',
|
|
@@ -42,7 +43,7 @@ export var setContext = function setContext(context) {
|
|
|
42
43
|
return true;
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
|
-
export function createMentionPlugin(
|
|
46
|
+
export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
46
47
|
var mentionProvider;
|
|
47
48
|
|
|
48
49
|
var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes) {
|
|
@@ -72,14 +73,14 @@ export function createMentionPlugin(dispatch, providerFactory, portalProviderAPI
|
|
|
72
73
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
73
74
|
mentionProvider: params.provider
|
|
74
75
|
});
|
|
75
|
-
dispatch(mentionPluginKey, newPluginState);
|
|
76
|
+
pmPluginFactoryParams.dispatch(mentionPluginKey, newPluginState);
|
|
76
77
|
return newPluginState;
|
|
77
78
|
|
|
78
79
|
case ACTIONS.SET_CONTEXT:
|
|
79
80
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
80
81
|
contextIdentifierProvider: params.context
|
|
81
82
|
});
|
|
82
|
-
dispatch(mentionPluginKey, newPluginState);
|
|
83
|
+
pmPluginFactoryParams.dispatch(mentionPluginKey, newPluginState);
|
|
83
84
|
return newPluginState;
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -88,7 +89,14 @@ export function createMentionPlugin(dispatch, providerFactory, portalProviderAPI
|
|
|
88
89
|
},
|
|
89
90
|
props: {
|
|
90
91
|
nodeViews: {
|
|
91
|
-
mention:
|
|
92
|
+
mention: getInlineNodeViewProducer({
|
|
93
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
94
|
+
Component: MentionNodeView,
|
|
95
|
+
extraComponentProps: {
|
|
96
|
+
providerFactory: pmPluginFactoryParams.providerFactory,
|
|
97
|
+
options: options
|
|
98
|
+
}
|
|
99
|
+
})
|
|
92
100
|
}
|
|
93
101
|
},
|
|
94
102
|
view: function view(editorView) {
|
|
@@ -126,13 +134,13 @@ export function createMentionPlugin(dispatch, providerFactory, portalProviderAPI
|
|
|
126
134
|
return;
|
|
127
135
|
};
|
|
128
136
|
|
|
129
|
-
providerFactory.subscribe('mentionProvider', providerHandler);
|
|
130
|
-
providerFactory.subscribe('contextIdentifierProvider', providerHandler);
|
|
137
|
+
pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
|
|
138
|
+
pmPluginFactoryParams.providerFactory.subscribe('contextIdentifierProvider', providerHandler);
|
|
131
139
|
return {
|
|
132
140
|
destroy: function destroy() {
|
|
133
|
-
if (providerFactory) {
|
|
134
|
-
providerFactory.unsubscribe('mentionProvider', providerHandler);
|
|
135
|
-
providerFactory.unsubscribe('contextIdentifierProvider', providerHandler);
|
|
141
|
+
if (pmPluginFactoryParams.providerFactory) {
|
|
142
|
+
pmPluginFactoryParams.providerFactory.unsubscribe('mentionProvider', providerHandler);
|
|
143
|
+
pmPluginFactoryParams.providerFactory.unsubscribe('contextIdentifierProvider', providerHandler);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
if (mentionProvider) {
|
|
@@ -378,10 +378,15 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
378
378
|
dismiss: function dismiss(_ref9) {
|
|
379
379
|
var editorState = _ref9.editorState,
|
|
380
380
|
query = _ref9.query,
|
|
381
|
-
stats = _ref9.stats
|
|
381
|
+
stats = _ref9.stats,
|
|
382
|
+
wasItemInserted = _ref9.wasItemInserted;
|
|
382
383
|
firstQueryWithoutResults = null;
|
|
383
384
|
var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
|
|
384
|
-
|
|
385
|
+
|
|
386
|
+
if (!wasItemInserted) {
|
|
387
|
+
fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
|
|
388
|
+
}
|
|
389
|
+
|
|
385
390
|
var pluginState = getMentionPluginState(editorState);
|
|
386
391
|
|
|
387
392
|
if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
|
|
@@ -5,6 +5,7 @@ var _templateObject;
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { panelSharedStyles, PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
7
7
|
import { SelectionStyle, getSelectionStyles, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { token } from '@atlaskit/tokens';
|
|
8
9
|
export var panelStyles = function panelStyles(props) {
|
|
9
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])), PanelSharedCssClassName.prefix, akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground, PanelSharedCssClassName.icon, akEditorDeleteIconColor, PanelSharedCssClassName.content, PanelSharedCssClassName.prefix, akEditorDeleteBackgroundWithOpacity, PanelSharedCssClassName.icon, akEditorDeleteIconColor, panelSharedStyles(props), PanelSharedCssClassName.prefix, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]));
|
|
10
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])), PanelSharedCssClassName.prefix, akEditorSelectedBorderSize, akEditorDeleteBorder, token('color.background.danger', akEditorDeleteBackground), PanelSharedCssClassName.icon, token('color.icon.danger', akEditorDeleteIconColor), PanelSharedCssClassName.content, PanelSharedCssClassName.prefix, token('color.blanket.danger', akEditorDeleteBackgroundWithOpacity), PanelSharedCssClassName.icon, token('color.icon.danger', akEditorDeleteIconColor), panelSharedStyles(props), PanelSharedCssClassName.prefix, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]));
|
|
10
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
|
|
5
5
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { Slice, Fragment } from 'prosemirror-model';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { PluginKey } from 'prosemirror-state';
|
|
@@ -5,7 +5,9 @@ import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
|
5
5
|
|
|
6
6
|
var serializePlaceholderNode = function serializePlaceholderNode(node) {
|
|
7
7
|
var element = document.createElement('span');
|
|
8
|
-
element.classList.add('pm-placeholder');
|
|
8
|
+
element.classList.add('pm-placeholder'); // the inline node api test suite requires the following class name
|
|
9
|
+
|
|
10
|
+
element.classList.add('placeholderView-content-wrap');
|
|
9
11
|
|
|
10
12
|
if (browser.gecko) {
|
|
11
13
|
element.setAttribute('contenteditable', 'true');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -5,6 +5,7 @@ var _templateObject;
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { ruleSharedStyles } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { akEditorLineHeight, akEditorSelectedBorderColor, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { token } from '@atlaskit/tokens';
|
|
8
9
|
export var ruleStyles = function ruleStyles(props) {
|
|
9
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])), ruleSharedStyles(props), akEditorLineHeight, akEditorSelectedNodeClassName, akEditorSelectedBorderColor);
|
|
10
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])), ruleSharedStyles(props), akEditorLineHeight, akEditorSelectedNodeClassName, token('color.border.selected', akEditorSelectedBorderColor));
|
|
10
11
|
};
|
|
@@ -39,7 +39,7 @@ export var getDecorations = function getDecorations(tr) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (tr.selection instanceof TextSelection || tr.selection instanceof AllSelection) {
|
|
42
|
-
var decorations =
|
|
42
|
+
var decorations = getNodesToDecorateFromSelection(tr.selection, tr.doc).map(function (_ref) {
|
|
43
43
|
var node = _ref.node,
|
|
44
44
|
pos = _ref.pos;
|
|
45
45
|
return Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -91,38 +91,53 @@ export function getCellSelectionAnalyticsPayload(state) {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
var topLevelBlockNodesThatHaveSelectionStyles = ['table', 'panel', 'expand', 'layoutSection', 'decisionList', 'decisionItem', 'codeBlock'];
|
|
94
95
|
/**
|
|
95
|
-
* Use `
|
|
96
|
-
* a list of
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* For example, using the following document:
|
|
102
|
-
* ```
|
|
103
|
-
* doc(p('{<}one'), blockquote(p('hello')), p(expand({ title: 'two' })(p('three'))), p('four{>}'))))
|
|
104
|
-
* ```
|
|
105
|
-
* we would expect `getTopLevelNodesFromSelection` to return:
|
|
106
|
-
* ```
|
|
107
|
-
* [blockquote(p('hello')), expand({ title: 'two' })(p('three')))]
|
|
108
|
-
* ```
|
|
96
|
+
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
97
|
+
* a list of nodes within the Selection that should have Selection
|
|
98
|
+
* decorations applied. This allows selection styles to be added to
|
|
99
|
+
* nested nodes. It will ignore text nodes as decorations are
|
|
100
|
+
* applied natively and also ignore nodes that don't completely
|
|
101
|
+
* sit within the given `Selection`.
|
|
109
102
|
*/
|
|
110
103
|
|
|
111
|
-
export var
|
|
104
|
+
export var getNodesToDecorateFromSelection = function getNodesToDecorateFromSelection(selection, doc) {
|
|
112
105
|
var nodes = [];
|
|
113
106
|
|
|
114
107
|
if (selection.from !== selection.to) {
|
|
115
108
|
var from = selection.from,
|
|
116
109
|
to = selection.to;
|
|
117
110
|
doc.nodesBetween(from, to, function (node, pos) {
|
|
118
|
-
var withinSelection = from <= pos && pos + node.nodeSize <= to;
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
var withinSelection = from <= pos && pos + node.nodeSize <= to; // The reason we need to check for these nodes is to stop
|
|
112
|
+
// traversing their children if they are within a selection -
|
|
113
|
+
// this is to prevent selection styles from being added to
|
|
114
|
+
// the children as well as the parent node.
|
|
115
|
+
// Example scenario is if an entire table has been selected
|
|
116
|
+
// we should not traverse its children so we can apply the
|
|
117
|
+
// selection styles to the table. But if an entire tableRow
|
|
118
|
+
// has been selected (but the parent table has not) we should
|
|
119
|
+
// traverse it as it could contain other nodes that need
|
|
120
|
+
// selection styles. I couldn’t see a clear way to differentiate
|
|
121
|
+
// without explicitly stating which nodes should be traversed
|
|
122
|
+
// and which shouldn’t.
|
|
123
|
+
|
|
124
|
+
var isTopLevelNodeThatHasSelectionStyles = topLevelBlockNodesThatHaveSelectionStyles.includes(node.type.name); // If the node is a top-level block node and completely sits within
|
|
125
|
+
// the selection, we do not recurse it's children to prevent selection
|
|
126
|
+
// styles being added to its child nodes. The expected behaviour
|
|
127
|
+
// is that selection styles are only added to the parent.
|
|
128
|
+
|
|
129
|
+
if (node && withinSelection && isTopLevelNodeThatHasSelectionStyles) {
|
|
130
|
+
nodes.push({
|
|
131
|
+
node: node,
|
|
132
|
+
pos: pos
|
|
133
|
+
});
|
|
134
|
+
return false; // Otherwise we recurse the children and return them so we can apply
|
|
135
|
+
// selection styles. Text is handled by the browser.
|
|
136
|
+
} else if (node && withinSelection && !node.isText) {
|
|
121
137
|
nodes.push({
|
|
122
138
|
node: node,
|
|
123
139
|
pos: pos
|
|
124
140
|
});
|
|
125
|
-
return false;
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
return true;
|
|
@@ -254,9 +254,9 @@ export var handleMouseMove = function handleMouseMove(view, event, tableCellOpti
|
|
|
254
254
|
var useMouseMoveOptimisation = tableCellOptimization && mouseMoveOptimization;
|
|
255
255
|
|
|
256
256
|
if (!isResizeHandleDecoration(element) && isCell(element)) {
|
|
257
|
-
var
|
|
257
|
+
var positionColumn = getMousePositionHorizontalRelativeByElement(event, useMouseMoveOptimisation, elementContentRects, RESIZE_HANDLE_AREA_DECORATION_GAP);
|
|
258
258
|
|
|
259
|
-
if (
|
|
259
|
+
if (positionColumn !== null) {
|
|
260
260
|
var _state4 = view.state,
|
|
261
261
|
_dispatch5 = view.dispatch;
|
|
262
262
|
|
|
@@ -268,7 +268,7 @@ export var handleMouseMove = function handleMouseMove(view, event, tableCellOpti
|
|
|
268
268
|
var rect = findCellRectClosestToPos(_state4.doc.resolve(cellStartPosition));
|
|
269
269
|
|
|
270
270
|
if (rect) {
|
|
271
|
-
var columnEndIndexTarget =
|
|
271
|
+
var columnEndIndexTarget = positionColumn === 'left' ? rect.left : rect.right;
|
|
272
272
|
|
|
273
273
|
if (columnEndIndexTarget !== resizeHandleColumnIndex || !hasResizeHandler({
|
|
274
274
|
target: element,
|