@atlaskit/editor-core 150.0.0 → 151.0.0
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 +65 -0
- package/dist/cjs/actions/index.js +5 -23
- package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
- package/dist/cjs/create-editor/ReactEditorView.js +145 -31
- package/dist/cjs/create-editor/create-plugins-list.js +4 -2
- package/dist/cjs/editor.js +101 -40
- package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
- package/dist/cjs/plugins/analytics/types/enums.js +3 -1
- package/dist/cjs/plugins/base/index.js +4 -3
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/cjs/plugins/card/index.js +13 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
- package/dist/cjs/plugins/code-block/toolbar.js +1 -1
- package/dist/cjs/plugins/collab-edit/ui/to-avatar.js +4 -8
- package/dist/cjs/plugins/emoji/styles.js +1 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/cjs/plugins/extension/toolbar.js +28 -23
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +8 -3
- package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/cjs/plugins/hyperlink/utils.js +6 -69
- package/dist/cjs/plugins/media/index.js +14 -3
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
- package/dist/cjs/plugins/media/toolbar/index.js +49 -17
- package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
- package/dist/cjs/plugins/media/utils/media-files.js +67 -1
- package/dist/cjs/plugins/mentions/type-ahead/index.js +39 -3
- package/dist/cjs/plugins/panel/index.js +2 -3
- package/dist/cjs/plugins/panel/message.js +47 -0
- package/dist/cjs/plugins/panel/toolbar.js +64 -84
- package/dist/cjs/plugins/panel/utils.js +2 -2
- package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
- package/dist/cjs/plugins/status/styles.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/cjs/profiler/render-count.js +82 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +6 -28
- package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
- package/dist/es2019/create-editor/ReactEditorView.js +130 -23
- package/dist/es2019/create-editor/create-plugins-list.js +4 -2
- package/dist/es2019/editor.js +74 -35
- package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
- package/dist/es2019/plugins/analytics/types/enums.js +3 -1
- package/dist/es2019/plugins/base/index.js +4 -3
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
- package/dist/es2019/plugins/card/index.js +7 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/es2019/plugins/code-block/toolbar.js +1 -1
- package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
- package/dist/es2019/plugins/emoji/styles.js +2 -0
- package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/es2019/plugins/extension/toolbar.js +30 -25
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
- package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/es2019/plugins/hyperlink/utils.js +3 -59
- package/dist/es2019/plugins/media/index.js +13 -4
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
- package/dist/es2019/plugins/media/toolbar/index.js +44 -15
- package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
- package/dist/es2019/plugins/media/utils/media-files.js +68 -2
- package/dist/es2019/plugins/mentions/type-ahead/index.js +21 -2
- package/dist/es2019/plugins/panel/index.js +3 -4
- package/dist/es2019/plugins/panel/message.js +38 -0
- package/dist/es2019/plugins/panel/toolbar.js +52 -71
- package/dist/es2019/plugins/panel/utils.js +2 -2
- package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/es2019/plugins/status/styles.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/es2019/profiler/render-count.js +60 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +6 -24
- package/dist/esm/create-editor/ErrorBoundary.js +113 -78
- package/dist/esm/create-editor/ReactEditorView.js +146 -31
- package/dist/esm/create-editor/create-plugins-list.js +4 -2
- package/dist/esm/editor.js +100 -40
- package/dist/esm/labs/next/presets/cxhtml.js +2 -1
- package/dist/esm/plugins/analytics/types/enums.js +3 -1
- package/dist/esm/plugins/base/index.js +4 -3
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/esm/plugins/card/index.js +13 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/esm/plugins/code-block/toolbar.js +1 -1
- package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
- package/dist/esm/plugins/emoji/styles.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/esm/plugins/extension/toolbar.js +28 -23
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
- package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/esm/plugins/hyperlink/utils.js +3 -59
- package/dist/esm/plugins/media/index.js +14 -4
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
- package/dist/esm/plugins/media/toolbar/index.js +47 -19
- package/dist/esm/plugins/media/toolbar/utils.js +15 -1
- package/dist/esm/plugins/media/utils/media-files.js +60 -2
- package/dist/esm/plugins/mentions/type-ahead/index.js +39 -3
- package/dist/esm/plugins/panel/index.js +3 -4
- package/dist/esm/plugins/panel/message.js +38 -0
- package/dist/esm/plugins/panel/toolbar.js +57 -77
- package/dist/esm/plugins/panel/utils.js +2 -2
- package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/esm/plugins/status/styles.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/esm/profiler/render-count.js +57 -0
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
- package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
- package/dist/types/editor.d.ts +3 -1
- package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
- package/dist/types/plugins/analytics/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
- package/dist/types/plugins/analytics/types/events.d.ts +7 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
- package/dist/types/plugins/analytics/types/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -0
- package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
- package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/types.d.ts +6 -0
- package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types/plugins/extension/types.d.ts +0 -2
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
- package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
- package/dist/types/plugins/panel/message.d.ts +37 -0
- package/dist/types/plugins/panel/toolbar.d.ts +4 -37
- package/dist/types/plugins/panel/types.d.ts +1 -0
- package/dist/types/plugins/quick-insert/index.d.ts +1 -1
- package/dist/types/profiler/render-count.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui/LinkSearch/types.d.ts +1 -0
- package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
- package/package.json +20 -17
- package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
- package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
- package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
- package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
- package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
- package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
- package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
- package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
- package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
- package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
- package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
- package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
- package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
- package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
- package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
- package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
- package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
- package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
- package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
- package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
- package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
- package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
- package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
- package/dist/esm/plugins/code-block/language-list.test.js +0 -71
- package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/esm/plugins/media/commands/captions.test.js +0 -135
- package/dist/esm/plugins/media/commands/linking.test.js +0 -268
- package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/esm/plugins/panel/toolbar.test.js +0 -230
- package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
- package/dist/esm/ui/PortalProvider/index.test.js +0 -129
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getPosInList = exports.insertMediaGroupNode = void 0;
|
|
6
|
+
exports.getPosInList = exports.insertMediaGroupNode = exports.insertMediaInlineNode = exports.canInsertMediaInline = void 0;
|
|
7
7
|
|
|
8
8
|
var _prosemirrorModel = require("prosemirror-model");
|
|
9
9
|
|
|
@@ -19,6 +19,13 @@ var _nodes = require("../../../utils/nodes");
|
|
|
19
19
|
|
|
20
20
|
var _analytics = require("../../analytics");
|
|
21
21
|
|
|
22
|
+
var canInsertMediaInline = function canInsertMediaInline(state) {
|
|
23
|
+
var node = state.schema.nodes.mediaInline.create({});
|
|
24
|
+
return (0, _prosemirrorUtils.canInsert)(state.selection.$to, _prosemirrorModel.Fragment.from(node));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.canInsertMediaInline = canInsertMediaInline;
|
|
28
|
+
|
|
22
29
|
var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaState, inputMethod) {
|
|
23
30
|
var media = '';
|
|
24
31
|
|
|
@@ -40,6 +47,21 @@ var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaSt
|
|
|
40
47
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
41
48
|
};
|
|
42
49
|
};
|
|
50
|
+
|
|
51
|
+
var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(mediaState, inputMethod) {
|
|
52
|
+
var media = mediaState.fileMimeType || 'unknown';
|
|
53
|
+
return {
|
|
54
|
+
action: _analytics.ACTION.INSERTED,
|
|
55
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
56
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
|
|
57
|
+
attributes: {
|
|
58
|
+
type: _analytics.ACTION_SUBJECT_ID.MEDIA_INLINE,
|
|
59
|
+
inputMethod: inputMethod,
|
|
60
|
+
fileExtension: media
|
|
61
|
+
},
|
|
62
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
63
|
+
};
|
|
64
|
+
};
|
|
43
65
|
/**
|
|
44
66
|
* Check if current editor selections is a media group or not.
|
|
45
67
|
* @param state Editor state
|
|
@@ -64,6 +86,48 @@ function shouldAppendParagraph(state, node) {
|
|
|
64
86
|
var wasMediaNode = node && node.type === media;
|
|
65
87
|
return ((0, _utils.insideTableCell)(state) || (0, _utils.isInListItem)(state) || (0, _utils.isInLayoutColumn)(state) || (0, _position.atTheEndOfDoc)(state) && (!(0, _mediaCommon.posOfPrecedingMediaGroup)(state) || (0, _mediaCommon.isSelectionNonMediaBlockNode)(state))) && !wasMediaNode;
|
|
66
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a new media inline to insert the new media.
|
|
91
|
+
* @param view Editor view
|
|
92
|
+
* @param mediaState Media file to be added to the editor
|
|
93
|
+
* @param collection Collection for the media to be added
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
var insertMediaInlineNode = function insertMediaInlineNode(view, mediaState, collection, inputMethod) {
|
|
98
|
+
var state = view.state,
|
|
99
|
+
dispatch = view.dispatch;
|
|
100
|
+
var schema = state.schema,
|
|
101
|
+
tr = state.tr;
|
|
102
|
+
var mediaInline = schema.nodes.mediaInline; // Do nothing if no media found
|
|
103
|
+
|
|
104
|
+
if (!mediaInline || !mediaState || collection === undefined) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
var id = mediaState.id;
|
|
109
|
+
var mediaInlineNode = mediaInline.create({
|
|
110
|
+
id: id,
|
|
111
|
+
collection: collection
|
|
112
|
+
});
|
|
113
|
+
var space = state.schema.text(' ');
|
|
114
|
+
var pos = state.selection.$to.pos;
|
|
115
|
+
|
|
116
|
+
var content = _prosemirrorModel.Fragment.from([mediaInlineNode, space]); // Delete the selection if a selection is made
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
var deleteRange = findDeleteRange(state);
|
|
120
|
+
|
|
121
|
+
if (!deleteRange) {
|
|
122
|
+
tr.insert(pos, content);
|
|
123
|
+
} else {
|
|
124
|
+
tr.insert(pos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
(0, _analytics.addAnalytics)(state, tr, getInsertMediaInlineAnalytics(mediaState, inputMethod));
|
|
128
|
+
dispatch(tr);
|
|
129
|
+
return true;
|
|
130
|
+
};
|
|
67
131
|
/**
|
|
68
132
|
* Insert a media into an existing media group
|
|
69
133
|
* or create a new media group to insert the new media.
|
|
@@ -73,6 +137,8 @@ function shouldAppendParagraph(state, node) {
|
|
|
73
137
|
*/
|
|
74
138
|
|
|
75
139
|
|
|
140
|
+
exports.insertMediaInlineNode = insertMediaInlineNode;
|
|
141
|
+
|
|
76
142
|
var insertMediaGroupNode = function insertMediaGroupNode(view, mediaStates, collection, inputMethod) {
|
|
77
143
|
var state = view.state,
|
|
78
144
|
dispatch = view.dispatch;
|
|
@@ -40,6 +40,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
40
40
|
|
|
41
41
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
42
42
|
|
|
43
|
+
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; } } }; }
|
|
44
|
+
|
|
45
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
46
|
+
|
|
47
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
48
|
+
|
|
43
49
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
44
50
|
|
|
45
51
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -232,6 +238,7 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
232
238
|
HighlightComponent = _ref6.HighlightComponent;
|
|
233
239
|
var sessionId = (0, _uuid.default)();
|
|
234
240
|
var firstQueryWithoutResults = null;
|
|
241
|
+
var subscriptionKeys = new Set();
|
|
235
242
|
var typeAhead = {
|
|
236
243
|
id: _typeAhead.TypeAheadAvailableNodes.MENTION,
|
|
237
244
|
trigger: '@',
|
|
@@ -278,9 +285,15 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
278
285
|
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.default)());
|
|
279
286
|
|
|
280
287
|
var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
|
|
281
|
-
var
|
|
288
|
+
var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
282
289
|
var stats = arguments.length > 2 ? arguments[2] : undefined;
|
|
290
|
+
|
|
291
|
+
if (query !== resultQuery) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
283
295
|
mentionProvider.unsubscribe(key);
|
|
296
|
+
subscriptionKeys.delete(key);
|
|
284
297
|
var mentionItems = mentions.map(function (mention) {
|
|
285
298
|
return memoizedToItem.call(mention);
|
|
286
299
|
});
|
|
@@ -316,13 +329,14 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
316
329
|
}
|
|
317
330
|
};
|
|
318
331
|
|
|
332
|
+
subscriptionKeys.add(key);
|
|
319
333
|
mentionProvider.subscribe(key, mentionsSubscribeCallback);
|
|
320
334
|
mentionProvider.filter(query || '', _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
321
335
|
sessionId: sessionId
|
|
322
336
|
}));
|
|
323
337
|
});
|
|
324
338
|
},
|
|
325
|
-
onOpen: function onOpen(
|
|
339
|
+
onOpen: function onOpen() {
|
|
326
340
|
firstQueryWithoutResults = null;
|
|
327
341
|
},
|
|
328
342
|
selectItem: function selectItem(state, item, insert, _ref8) {
|
|
@@ -394,11 +408,33 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
394
408
|
return insert(_prosemirrorModel.Fragment.from([mentionNode, space]));
|
|
395
409
|
},
|
|
396
410
|
dismiss: function dismiss(_ref9) {
|
|
397
|
-
var
|
|
411
|
+
var editorState = _ref9.editorState,
|
|
412
|
+
query = _ref9.query,
|
|
398
413
|
stats = _ref9.stats;
|
|
399
414
|
firstQueryWithoutResults = null;
|
|
400
415
|
var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
|
|
401
416
|
fireEvent((0, _analytics.buildTypeAheadCancelPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
|
|
417
|
+
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
418
|
+
|
|
419
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
|
|
420
|
+
var mentionProvider = pluginState.mentionProvider;
|
|
421
|
+
|
|
422
|
+
var _iterator = _createForOfIteratorHelper(subscriptionKeys),
|
|
423
|
+
_step;
|
|
424
|
+
|
|
425
|
+
try {
|
|
426
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
427
|
+
var key = _step.value;
|
|
428
|
+
mentionProvider.unsubscribe(key);
|
|
429
|
+
}
|
|
430
|
+
} catch (err) {
|
|
431
|
+
_iterator.e(err);
|
|
432
|
+
} finally {
|
|
433
|
+
_iterator.f();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
subscriptionKeys.clear();
|
|
402
438
|
sessionId = (0, _uuid.default)();
|
|
403
439
|
}
|
|
404
440
|
};
|
|
@@ -55,8 +55,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
55
55
|
return {
|
|
56
56
|
name: 'panel',
|
|
57
57
|
nodes: function nodes() {
|
|
58
|
-
|
|
59
|
-
var panelNode = options.UNSAFE_allowCustomPanel ? _adfSchema.customPanel : _adfSchema.panel;
|
|
58
|
+
var panelNode = (0, _adfSchema.customPanel)(!!options.UNSAFE_allowCustomPanel);
|
|
60
59
|
return [{
|
|
61
60
|
name: 'panel',
|
|
62
61
|
node: panelNode
|
|
@@ -149,7 +148,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
149
148
|
}
|
|
150
149
|
}];
|
|
151
150
|
|
|
152
|
-
if (options.UNSAFE_allowCustomPanel) {
|
|
151
|
+
if (options.UNSAFE_allowCustomPanelEdit && options.UNSAFE_allowCustomPanel) {
|
|
153
152
|
quickInsertOptions.push({
|
|
154
153
|
id: 'custompanel',
|
|
155
154
|
title: formatMessage(_messages.messages.customPanel),
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactIntl = require("react-intl");
|
|
9
|
+
|
|
10
|
+
var messages = (0, _reactIntl.defineMessages)({
|
|
11
|
+
info: {
|
|
12
|
+
id: 'fabric.editor.info',
|
|
13
|
+
defaultMessage: 'Info',
|
|
14
|
+
description: 'Panels provide a way to highlight text. The info panel has a blue background.'
|
|
15
|
+
},
|
|
16
|
+
note: {
|
|
17
|
+
id: 'fabric.editor.note',
|
|
18
|
+
defaultMessage: 'Note',
|
|
19
|
+
description: 'Panels provide a way to highlight text. The note panel has a purple background.'
|
|
20
|
+
},
|
|
21
|
+
success: {
|
|
22
|
+
id: 'fabric.editor.success',
|
|
23
|
+
defaultMessage: 'Success',
|
|
24
|
+
description: 'Panels provide a way to highlight text. The success panel has a green background.'
|
|
25
|
+
},
|
|
26
|
+
warning: {
|
|
27
|
+
id: 'fabric.editor.warning',
|
|
28
|
+
defaultMessage: 'Warning',
|
|
29
|
+
description: 'Panels provide a way to highlight text. The warning panel has a yellow background.'
|
|
30
|
+
},
|
|
31
|
+
error: {
|
|
32
|
+
id: 'fabric.editor.error',
|
|
33
|
+
defaultMessage: 'Error',
|
|
34
|
+
description: 'Panels provide a way to highlight text. The error panel has a red background.'
|
|
35
|
+
},
|
|
36
|
+
emoji: {
|
|
37
|
+
id: 'fabric.editor.panel.emoji',
|
|
38
|
+
defaultMessage: 'Add emoji',
|
|
39
|
+
description: 'Select the panel icon'
|
|
40
|
+
},
|
|
41
|
+
backgroundColor: {
|
|
42
|
+
id: 'fabric.editor.panel.backgroundColor',
|
|
43
|
+
defaultMessage: 'Background color',
|
|
44
|
+
description: 'Select the panel background color.'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
exports.messages = messages;
|
|
@@ -5,9 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getToolbarConfig = exports.getToolbarItems = exports.
|
|
8
|
+
exports.getToolbarConfig = exports.getToolbarItems = exports.panelIconMap = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
12
|
var _success = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/success"));
|
|
13
13
|
|
|
@@ -43,81 +43,53 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
43
43
|
|
|
44
44
|
var _analytics = require("../analytics");
|
|
45
45
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
id: 'fabric.editor.note',
|
|
54
|
-
defaultMessage: 'Note',
|
|
55
|
-
description: 'Panels provide a way to highlight text. The note panel has a purple background.'
|
|
56
|
-
},
|
|
57
|
-
success: {
|
|
58
|
-
id: 'fabric.editor.success',
|
|
59
|
-
defaultMessage: 'Success',
|
|
60
|
-
description: 'Panels provide a way to highlight text. The success panel has a green background.'
|
|
61
|
-
},
|
|
62
|
-
warning: {
|
|
63
|
-
id: 'fabric.editor.warning',
|
|
64
|
-
defaultMessage: 'Warning',
|
|
65
|
-
description: 'Panels provide a way to highlight text. The warning panel has a yellow background.'
|
|
66
|
-
},
|
|
67
|
-
error: {
|
|
68
|
-
id: 'fabric.editor.error',
|
|
69
|
-
defaultMessage: 'Error',
|
|
70
|
-
description: 'Panels provide a way to highlight text. The error panel has a red background.'
|
|
71
|
-
},
|
|
72
|
-
emoji: {
|
|
73
|
-
id: 'fabric.editor.panel.emoji',
|
|
74
|
-
defaultMessage: 'Add emoji',
|
|
75
|
-
description: 'Select the panel icon'
|
|
76
|
-
},
|
|
77
|
-
backgroundColor: {
|
|
78
|
-
id: 'fabric.editor.panel.backgroundColor',
|
|
79
|
-
defaultMessage: 'Background color',
|
|
80
|
-
description: 'Select the panel background color.'
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
exports.messages = messages;
|
|
46
|
+
var _message = require("./message");
|
|
47
|
+
|
|
48
|
+
var _panelIconMap;
|
|
49
|
+
|
|
50
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
51
|
+
|
|
52
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
84
53
|
|
|
85
|
-
var
|
|
54
|
+
var panelIconMap = (_panelIconMap = {}, (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.INFO, ':info:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.NOTE, ':note:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.WARNING, ':warning:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.ERROR, ':error:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.SUCCESS, ':success:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.TIP, ':tip:'), _panelIconMap);
|
|
55
|
+
exports.panelIconMap = panelIconMap;
|
|
56
|
+
|
|
57
|
+
var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon) {
|
|
86
58
|
var items = [{
|
|
87
59
|
id: 'editor.panel.info',
|
|
88
60
|
type: 'button',
|
|
89
61
|
icon: _info.default,
|
|
90
62
|
onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.INFO),
|
|
91
63
|
selected: activePanelType === _adfSchema.PanelType.INFO,
|
|
92
|
-
title: formatMessage(messages.info)
|
|
64
|
+
title: formatMessage(_message.messages.info)
|
|
93
65
|
}, {
|
|
94
66
|
id: 'editor.panel.note',
|
|
95
67
|
type: 'button',
|
|
96
68
|
icon: _note.default,
|
|
97
69
|
onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.NOTE),
|
|
98
70
|
selected: activePanelType === _adfSchema.PanelType.NOTE,
|
|
99
|
-
title: formatMessage(messages.note)
|
|
71
|
+
title: formatMessage(_message.messages.note)
|
|
100
72
|
}, {
|
|
101
73
|
id: 'editor.panel.success',
|
|
102
74
|
type: 'button',
|
|
103
75
|
icon: _success.default,
|
|
104
76
|
onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.SUCCESS),
|
|
105
77
|
selected: activePanelType === _adfSchema.PanelType.SUCCESS,
|
|
106
|
-
title: formatMessage(messages.success)
|
|
78
|
+
title: formatMessage(_message.messages.success)
|
|
107
79
|
}, {
|
|
108
80
|
id: 'editor.panel.warning',
|
|
109
81
|
type: 'button',
|
|
110
82
|
icon: _warning.default,
|
|
111
83
|
onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.WARNING),
|
|
112
84
|
selected: activePanelType === _adfSchema.PanelType.WARNING,
|
|
113
|
-
title: formatMessage(messages.warning)
|
|
85
|
+
title: formatMessage(_message.messages.warning)
|
|
114
86
|
}, {
|
|
115
87
|
id: 'editor.panel.error',
|
|
116
88
|
type: 'button',
|
|
117
89
|
icon: _error.default,
|
|
118
90
|
onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.ERROR),
|
|
119
91
|
selected: activePanelType === _adfSchema.PanelType.ERROR,
|
|
120
|
-
title: formatMessage(messages.error)
|
|
92
|
+
title: formatMessage(_message.messages.error)
|
|
121
93
|
}];
|
|
122
94
|
|
|
123
95
|
if (isCustomPanelEnabled) {
|
|
@@ -130,11 +102,16 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
130
102
|
}
|
|
131
103
|
|
|
132
104
|
var previousColor = panelNode.node.attrs.panelColor || (0, _editorCommon.getPanelTypeBackground)(panelNode.node.attrs.panelType);
|
|
105
|
+
var emojiInfo = panelNode.node.attrs.panelType;
|
|
106
|
+
var panelInfo = panelIconMap[emojiInfo];
|
|
107
|
+
var previousEmoji = panelInfo ? {
|
|
108
|
+
emoji: panelInfo
|
|
109
|
+
} : {};
|
|
133
110
|
|
|
134
111
|
if (previousColor === color) {
|
|
135
|
-
(0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
112
|
+
(0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, _objectSpread({
|
|
136
113
|
color: color
|
|
137
|
-
}, isCustomPanelEnabled)(state, dispatch);
|
|
114
|
+
}, previousEmoji), isCustomPanelEnabled)(state, dispatch);
|
|
138
115
|
return false;
|
|
139
116
|
}
|
|
140
117
|
|
|
@@ -148,9 +125,9 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
148
125
|
},
|
|
149
126
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
150
127
|
};
|
|
151
|
-
(0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
128
|
+
(0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, _objectSpread({
|
|
152
129
|
color: color
|
|
153
|
-
}, isCustomPanelEnabled))(state, dispatch);
|
|
130
|
+
}, previousEmoji), isCustomPanelEnabled))(state, dispatch);
|
|
154
131
|
return false;
|
|
155
132
|
};
|
|
156
133
|
};
|
|
@@ -225,39 +202,42 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
225
202
|
value: panelColor,
|
|
226
203
|
border: _Palettes.DEFAULT_BORDER_COLOR
|
|
227
204
|
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
205
|
+
|
|
206
|
+
if (isCustomPanelEditable) {
|
|
207
|
+
var colorPicker = {
|
|
208
|
+
id: 'editor.panel.colorPicker',
|
|
209
|
+
title: formatMessage(_message.messages.backgroundColor),
|
|
210
|
+
type: 'select',
|
|
211
|
+
selectType: 'color',
|
|
212
|
+
defaultValue: defaultPalette,
|
|
213
|
+
options: _panelBackgroundPalette.panelBackgroundPalette,
|
|
214
|
+
onChange: function onChange(option) {
|
|
215
|
+
return changeColor(option.value);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var emojiPicker = {
|
|
219
|
+
id: 'editor.panel.emojiPicker',
|
|
220
|
+
title: formatMessage(_message.messages.emoji),
|
|
221
|
+
type: 'select',
|
|
222
|
+
selectType: 'emoji',
|
|
223
|
+
options: [],
|
|
224
|
+
selected: activePanelType === _adfSchema.PanelType.CUSTOM && !!activePanelIcon,
|
|
225
|
+
onChange: function onChange(emojiShortName) {
|
|
226
|
+
return changeEmoji(emojiShortName);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var removeEmojiButton = {
|
|
230
|
+
id: 'editor.panel.removeEmoji',
|
|
231
|
+
type: 'button',
|
|
232
|
+
icon: _EditorRemoveEmojiIcon.default,
|
|
233
|
+
onClick: removeEmoji(),
|
|
234
|
+
title: formatMessage(_messages.default.removeEmoji),
|
|
235
|
+
disabled: activePanelIcon ? false : true
|
|
236
|
+
};
|
|
237
|
+
items.push(emojiPicker, removeEmojiButton, {
|
|
238
|
+
type: 'separator'
|
|
239
|
+
}, colorPicker);
|
|
240
|
+
}
|
|
261
241
|
}
|
|
262
242
|
|
|
263
243
|
items.push({
|
|
@@ -292,7 +272,7 @@ var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
292
272
|
panelColor = _panelObject$node$att.panelColor,
|
|
293
273
|
panelIcon = _panelObject$node$att.panelIcon; // force toolbar to be turned on
|
|
294
274
|
|
|
295
|
-
var items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
|
|
275
|
+
var items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, options.UNSAFE_allowCustomPanel && options.UNSAFE_allowCustomPanelEdit || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
|
|
296
276
|
|
|
297
277
|
var getDomRef = function getDomRef(editorView) {
|
|
298
278
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -30,7 +30,7 @@ var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
|
|
|
30
30
|
'data-panel-type': panelType || _adfSchema.PanelType.INFO,
|
|
31
31
|
style: style
|
|
32
32
|
};
|
|
33
|
-
var
|
|
33
|
+
var iconDiv = ['div', {
|
|
34
34
|
class: _editorCommon.PanelSharedCssClassName.icon
|
|
35
35
|
}];
|
|
36
36
|
var contentDiv = ['div', {
|
|
@@ -38,7 +38,7 @@ var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
|
|
|
38
38
|
}, 0];
|
|
39
39
|
|
|
40
40
|
if (hasIcon) {
|
|
41
|
-
return ['div', panelAttrs,
|
|
41
|
+
return ['div', panelAttrs, iconDiv, contentDiv];
|
|
42
42
|
} else {
|
|
43
43
|
return ['div', panelAttrs, contentDiv];
|
|
44
44
|
}
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _linkifyIt = _interopRequireDefault(require("linkify-it"));
|
|
13
13
|
|
|
14
14
|
// modified version of the original Linkify plugin
|
|
15
15
|
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js
|
|
@@ -68,7 +68,7 @@ var linkify = function linkify(state) {
|
|
|
68
68
|
|
|
69
69
|
if (currentToken.type === 'text' && linkify.test(currentToken.content)) {
|
|
70
70
|
var text = currentToken.content;
|
|
71
|
-
var links = (0,
|
|
71
|
+
var links = (0, _adfSchema.linkifyMatch)(text);
|
|
72
72
|
|
|
73
73
|
if (!links.length) {
|
|
74
74
|
links = linkify.match(text) || [];
|
|
@@ -17,5 +17,5 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
17
17
|
|
|
18
18
|
var _templateObject;
|
|
19
19
|
|
|
20
|
-
var statusStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorDeleteBackgroundWithOpacity, _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder);
|
|
20
|
+
var statusStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorDeleteBackgroundWithOpacity, _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder);
|
|
21
21
|
exports.statusStyles = statusStyles;
|
|
@@ -498,10 +498,26 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
498
498
|
* so it should be safe to ignore mutations that we cause
|
|
499
499
|
* by updating styles and classnames on this DOM element
|
|
500
500
|
*
|
|
501
|
-
* Update: should
|
|
501
|
+
* Update: should not ignore mutations for row selection to avoid known issue with table selection highlight in firefox
|
|
502
502
|
* Related bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1289673
|
|
503
503
|
* */
|
|
504
|
-
|
|
504
|
+
var isTableSelection = mutationRecord.type === 'selection' && mutationRecord.target.nodeName === 'TR';
|
|
505
|
+
/**
|
|
506
|
+
* Update: should not ignore mutations when an node is added, as this interferes with
|
|
507
|
+
* prosemirrors handling of some language inputs in Safari (ie. Pinyin, Hiragana).
|
|
508
|
+
*
|
|
509
|
+
* In paticular, when a composition occurs at the start of the first node inside a table cell, if the resulting mutation
|
|
510
|
+
* from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
|
|
511
|
+
* selection and insertion.
|
|
512
|
+
*/
|
|
513
|
+
|
|
514
|
+
var isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
|
|
515
|
+
|
|
516
|
+
if (isTableSelection || isNodeInsertion) {
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
return true;
|
|
505
521
|
}
|
|
506
522
|
/* receive external events */
|
|
507
523
|
|
|
@@ -25,9 +25,26 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
var selection = tr.selection;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
if (!(selection instanceof _prosemirrorState.TextSelection)) {
|
|
30
|
+
return tr;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!selection.$cursor) {
|
|
34
|
+
tr.deleteSelection();
|
|
35
|
+
return tr;
|
|
36
|
+
} // Search & Destroy placeholder
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var cursorPos = selection.$cursor.pos;
|
|
40
|
+
var nodeAtCursor = tr.doc.nodeAt(cursorPos);
|
|
41
|
+
var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
|
|
42
|
+
|
|
43
|
+
if (nodeAtCursor && isPlaceholderAtCursorPosition) {
|
|
44
|
+
tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return tr;
|
|
31
48
|
};
|
|
32
49
|
};
|
|
33
50
|
|