@atlaskit/editor-core 150.0.3 → 151.1.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 +69 -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 +8 -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-bidi-warning/index.js +25 -0
- package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +43 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +118 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
- package/dist/cjs/plugins/code-block/index.js +10 -6
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/code-block/toolbar.js +1 -1
- 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 +9 -3
- package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
- 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/index.js +8 -0
- 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/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/rank.js +1 -1
- 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/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 +9 -3
- 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-bidi-warning/index.js +15 -0
- package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
- package/dist/es2019/plugins/code-block/index.js +6 -1
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
- package/dist/es2019/plugins/code-block/toolbar.js +1 -1
- 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 +9 -4
- package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
- 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/index.js +2 -1
- 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/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/rank.js +1 -1
- package/dist/es2019/plugins/status/styles.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- 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 +9 -3
- 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-bidi-warning/index.js +17 -0
- package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
- package/dist/esm/plugins/code-block/index.js +10 -6
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
- package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
- package/dist/esm/plugins/code-block/toolbar.js +1 -1
- 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 +9 -4
- package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
- 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/index.js +2 -1
- 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/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/rank.js +1 -1
- 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/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 +2 -0
- 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/code-bidi-warning/index.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
- package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
- package/dist/types/plugins/extension/types.d.ts +0 -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/HyperlinkToolbarAppearance.d.ts +1 -1
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
- package/dist/types/plugins/index.d.ts +1 -0
- 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/profiler/render-count.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +17 -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 +21 -18
- 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
|
@@ -11,6 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _prosemirrorState = require("prosemirror-state");
|
|
13
13
|
|
|
14
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
|
+
|
|
14
16
|
var _codeBlock = require("../nodeviews/code-block");
|
|
15
17
|
|
|
16
18
|
var _highlightingCodeBlock = require("../nodeviews/highlighting-code-block");
|
|
@@ -31,8 +33,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
31
33
|
|
|
32
34
|
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; }
|
|
33
35
|
|
|
34
|
-
var createPlugin = function createPlugin() {
|
|
35
|
-
var
|
|
36
|
+
var createPlugin = function createPlugin(_ref) {
|
|
37
|
+
var _ref$useLongPressSele = _ref.useLongPressSelection,
|
|
38
|
+
useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
|
|
39
|
+
reactContext = _ref.reactContext;
|
|
40
|
+
var intl = reactContext().intl;
|
|
41
|
+
var codeBidiWarningLabel = intl.formatMessage(_messages.codeBidiWarningMessages.label);
|
|
36
42
|
return new _prosemirrorState.Plugin({
|
|
37
43
|
state: {
|
|
38
44
|
init: function init(_, state) {
|
|
@@ -71,7 +77,10 @@ var createPlugin = function createPlugin() {
|
|
|
71
77
|
nodeViews: {
|
|
72
78
|
codeBlock: function codeBlock(node, view, getPos) {
|
|
73
79
|
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(view.state);
|
|
74
|
-
var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? (0, _highlightingCodeBlock.highlightingCodeBlockNodeView)(
|
|
80
|
+
var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? (0, _highlightingCodeBlock.highlightingCodeBlockNodeView)({
|
|
81
|
+
codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
|
|
82
|
+
codeBidiWarningLabel: codeBidiWarningLabel
|
|
83
|
+
}) : (0, _codeBlock.codeBlockNodeView)();
|
|
75
84
|
return createCodeBlockNodeView(node, view, getPos);
|
|
76
85
|
}
|
|
77
86
|
},
|
|
@@ -70,7 +70,7 @@ var getToolbarConfig = function getToolbarConfig() {
|
|
|
70
70
|
return option.value === language;
|
|
71
71
|
}) || options.find(function (option) {
|
|
72
72
|
return option.alias.includes(language);
|
|
73
|
-
}) :
|
|
73
|
+
}) : null;
|
|
74
74
|
var languageSelect = {
|
|
75
75
|
id: 'editor.codeBlock.languageOptions',
|
|
76
76
|
type: 'select',
|
|
@@ -21,7 +21,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
21
21
|
|
|
22
22
|
var _templateObject, _templateObject2;
|
|
23
23
|
|
|
24
|
-
var emojiStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", "\n > span {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _editorCommon.EmojiSharedCssClassName.EMOJI_CONTAINER, _editorCommon.EmojiSharedCssClassName.EMOJI_NODE, _editorCommon.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.EmojiSharedCssClassName.EMOJI_SPRITE, _editorCommon.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
|
|
24
|
+
var emojiStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", "\n > span {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _editorCommon.EmojiSharedCssClassName.EMOJI_CONTAINER, _editorCommon.EmojiSharedCssClassName.EMOJI_NODE, _editorCommon.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.EmojiSharedCssClassName.EMOJI_SPRITE, _editorCommon.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
|
|
25
25
|
exports.emojiStyles = emojiStyles;
|
|
26
26
|
var grid = (0, _constants.gridSize)() / 2;
|
|
27
27
|
var fontSize = (0, _constants.fontSizeSmall)();
|
|
@@ -295,7 +295,6 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
295
295
|
var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
296
296
|
var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
|
|
297
297
|
var state = (0, _pluginFactory.createPluginState)(dispatch, {
|
|
298
|
-
layout: 'default',
|
|
299
298
|
showEditButton: false,
|
|
300
299
|
showContextPanel: false
|
|
301
300
|
});
|
|
@@ -348,14 +347,12 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
348
347
|
var showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
|
|
349
348
|
var updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(function () {// do nothing;
|
|
350
349
|
});
|
|
351
|
-
var layout = selectedExtension ? node.attrs.layout : 'default';
|
|
352
350
|
(0, _commands.updateState)({
|
|
353
351
|
localId: node.attrs.localId,
|
|
354
352
|
showContextPanel: false,
|
|
355
353
|
element: newElement,
|
|
356
354
|
showEditButton: showEditButton,
|
|
357
|
-
updateExtension: updateExtension
|
|
358
|
-
layout: layout
|
|
355
|
+
updateExtension: updateExtension
|
|
359
356
|
})(state, dispatch);
|
|
360
357
|
} // New DOM element doesn't necessarily mean it's a new Node
|
|
361
358
|
else if (element !== newElement) {
|
|
@@ -62,28 +62,33 @@ var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
|
|
|
62
62
|
return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !(0, _prosemirrorUtils.hasParentNodeOfType)([bodiedExtension, table, expand].filter(Boolean))(selection)) && !(0, _prosemirrorUtils.hasParentNodeOfType)([layoutSection])(selection));
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
var breakoutOptions = function breakoutOptions(state, formatMessage,
|
|
66
|
-
var nodeWithPos = (0, _utils.getSelectedExtension)(state, true);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
var breakoutOptions = function breakoutOptions(state, formatMessage, breakoutEnabled) {
|
|
66
|
+
var nodeWithPos = (0, _utils.getSelectedExtension)(state, true); // we should only return breakout options when breakouts are enabled and the node supports them
|
|
67
|
+
|
|
68
|
+
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
|
|
69
|
+
var layout = nodeWithPos.node.attrs.layout;
|
|
70
|
+
return [{
|
|
71
|
+
type: 'button',
|
|
72
|
+
icon: _mediaCenter.default,
|
|
73
|
+
onClick: (0, _commands.updateExtensionLayout)('default'),
|
|
74
|
+
selected: layout === 'default',
|
|
75
|
+
title: formatMessage(_messages.default.layoutFixedWidth)
|
|
76
|
+
}, {
|
|
77
|
+
type: 'button',
|
|
78
|
+
icon: _mediaWide.default,
|
|
79
|
+
onClick: (0, _commands.updateExtensionLayout)('wide'),
|
|
80
|
+
selected: layout === 'wide',
|
|
81
|
+
title: formatMessage(_messages.default.layoutWide)
|
|
82
|
+
}, {
|
|
83
|
+
type: 'button',
|
|
84
|
+
icon: _mediaFullWidth.default,
|
|
85
|
+
onClick: (0, _commands.updateExtensionLayout)('full-width'),
|
|
86
|
+
selected: layout === 'full-width',
|
|
87
|
+
title: formatMessage(_messages.default.layoutFullWidth)
|
|
88
|
+
}];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return [];
|
|
87
92
|
};
|
|
88
93
|
|
|
89
94
|
var editButton = function editButton(formatMessage, extensionState) {
|
|
@@ -119,7 +124,7 @@ var getToolbarConfig = function getToolbarConfig() {
|
|
|
119
124
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
120
125
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
|
|
121
126
|
var editButtonArray = editButton(formatMessage, extensionState);
|
|
122
|
-
var breakoutButtonArray = breakoutOptions(state, formatMessage,
|
|
127
|
+
var breakoutButtonArray = breakoutOptions(state, formatMessage, breakoutEnabled);
|
|
123
128
|
return {
|
|
124
129
|
title: 'Extension floating controls',
|
|
125
130
|
getDomRef: function getDomRef() {
|
|
@@ -13,6 +13,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
|
|
14
14
|
var _normalizeFeatureFlags = require("@atlaskit/editor-common/normalize-feature-flags");
|
|
15
15
|
|
|
16
|
+
var _editorCommon = require("@atlaskit/editor-common");
|
|
17
|
+
|
|
16
18
|
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; }
|
|
17
19
|
|
|
18
20
|
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; }
|
|
@@ -22,9 +24,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
22
24
|
* which is used by both current and archv3 editors.
|
|
23
25
|
*/
|
|
24
26
|
function createFeatureFlagsFromProps(props) {
|
|
25
|
-
var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25;
|
|
27
|
+
var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29;
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
|
|
30
|
+
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
28
31
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
29
32
|
interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
|
|
30
33
|
placeholderBracketHint: !!props.placeholderBracketHint,
|
|
@@ -49,6 +52,9 @@ function createFeatureFlagsFromProps(props) {
|
|
|
49
52
|
errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.useErrorBoundaryDocStructure) : false),
|
|
50
53
|
synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.synchronyErrorDocStructure) : false),
|
|
51
54
|
enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.enableViewUpdateSubscription) : false),
|
|
52
|
-
collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false)
|
|
55
|
+
collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false),
|
|
56
|
+
ufo: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.ufo) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.ufo) : false),
|
|
57
|
+
codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !_editorCommon.browser.safari : false),
|
|
58
|
+
codeBidiWarnings: Boolean(typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.codeBidiWarnings) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.codeBidiWarnings) : true)
|
|
53
59
|
});
|
|
54
60
|
}
|
|
@@ -110,12 +110,16 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindChange", function (event) {
|
|
113
|
-
|
|
114
|
-
_this.updateFindValue(event.target.value);
|
|
115
|
-
});
|
|
113
|
+
_this.updateFindValue(event.target.value);
|
|
116
114
|
});
|
|
117
115
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateFindValue", function (value) {
|
|
118
|
-
_this.
|
|
116
|
+
_this.setState({
|
|
117
|
+
localFindText: value
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_this.skipWhileComposing(function () {
|
|
121
|
+
_this.props.onFind(value);
|
|
122
|
+
});
|
|
119
123
|
});
|
|
120
124
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindKeyDown", function (event) {
|
|
121
125
|
return _this.skipWhileComposing(function () {
|
|
@@ -187,7 +191,13 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
187
191
|
});
|
|
188
192
|
_this.closeIcon = /*#__PURE__*/_react.default.createElement(_close.default, {
|
|
189
193
|
label: _this.closeFindReplaceDialog
|
|
190
|
-
});
|
|
194
|
+
}); // We locally manage the value of the input inside this component in order to support compositions.
|
|
195
|
+
// This requires some additional work inside componentDidUpdate to ensure we support changes that
|
|
196
|
+
// occur to this value which do not originate from this component.
|
|
197
|
+
|
|
198
|
+
_this.state = {
|
|
199
|
+
localFindText: _this.props.findText || ''
|
|
200
|
+
};
|
|
191
201
|
return _this;
|
|
192
202
|
}
|
|
193
203
|
|
|
@@ -200,7 +210,17 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
200
210
|
}, {
|
|
201
211
|
key: "componentDidUpdate",
|
|
202
212
|
value: function componentDidUpdate() {
|
|
203
|
-
this.focusFindTextfield();
|
|
213
|
+
this.focusFindTextfield(); // If the external prop findText changes and we aren't in a composition we should update to the
|
|
214
|
+
// use the external prop value.
|
|
215
|
+
//
|
|
216
|
+
// An example of where this may happen is when a find occurs through the user selecting some text
|
|
217
|
+
// and pressing Mod-f.
|
|
218
|
+
|
|
219
|
+
if (!this.isComposing && this.props.findText !== this.state.localFindText) {
|
|
220
|
+
this.setState({
|
|
221
|
+
localFindText: this.props.findText || ''
|
|
222
|
+
});
|
|
223
|
+
}
|
|
204
224
|
}
|
|
205
225
|
}, {
|
|
206
226
|
key: "render",
|
|
@@ -219,7 +239,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
219
239
|
name: "find",
|
|
220
240
|
appearance: "none",
|
|
221
241
|
placeholder: this.find,
|
|
222
|
-
value:
|
|
242
|
+
value: this.state.localFindText,
|
|
223
243
|
ref: this.findTextfieldRef,
|
|
224
244
|
autoComplete: "off",
|
|
225
245
|
onChange: this.handleFindChange,
|
|
@@ -177,10 +177,10 @@ var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
(0, _createClass2.default)(HyperlinkToolbarAppearance, [{
|
|
180
|
-
key: "
|
|
180
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
181
181
|
value: // needed so we display the right state on the Toolbar while the same Toolbar
|
|
182
182
|
// instance is visible and we click other link
|
|
183
|
-
function
|
|
183
|
+
function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
184
184
|
if (nextProps.url !== this.props.url) {
|
|
185
185
|
this.resolveUrl(nextProps.url);
|
|
186
186
|
}
|
|
@@ -10,9 +10,9 @@ exports.default = void 0;
|
|
|
10
10
|
|
|
11
11
|
var _prosemirrorKeymap = require("prosemirror-keymap");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var keymaps = _interopRequireWildcard(require("../../../keymaps"));
|
|
16
16
|
|
|
17
17
|
var _main = require("../pm-plugins/main");
|
|
18
18
|
|
|
@@ -62,7 +62,7 @@ var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(skipA
|
|
|
62
62
|
|
|
63
63
|
var words = nodeBefore.text.split(' ');
|
|
64
64
|
var lastWord = words[words.length - 1];
|
|
65
|
-
var match = (0,
|
|
65
|
+
var match = (0, _adfSchema.getLinkMatch)(lastWord);
|
|
66
66
|
|
|
67
67
|
if (match) {
|
|
68
68
|
var hyperlinkedText = match.raw;
|
|
@@ -144,7 +144,8 @@ var mapActivityProviderResultToLinkSearchItemData = function mapActivityProvider
|
|
|
144
144
|
container: container,
|
|
145
145
|
iconUrl: iconUrl,
|
|
146
146
|
url: url,
|
|
147
|
-
lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined
|
|
147
|
+
lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined,
|
|
148
|
+
prefetch: true
|
|
148
149
|
};
|
|
149
150
|
};
|
|
150
151
|
|
|
@@ -161,7 +162,8 @@ var mapSearchProviderResultToLinkSearchItemData = function mapSearchProviderResu
|
|
|
161
162
|
name: title,
|
|
162
163
|
url: url,
|
|
163
164
|
lastUpdatedDate: updatedTimestamp ? new Date(updatedTimestamp) : undefined,
|
|
164
|
-
icon: contentType && _utils2.mapContentTypeToIcon[contentType] || defaultIcon
|
|
165
|
+
icon: contentType && _utils2.mapContentTypeToIcon[contentType] || defaultIcon,
|
|
166
|
+
prefetch: false
|
|
165
167
|
};
|
|
166
168
|
};
|
|
167
169
|
|
|
@@ -502,7 +504,7 @@ var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
502
504
|
}
|
|
503
505
|
|
|
504
506
|
if (interaction === 'click' || _this.isUrlPopulatedWithSelectedItem()) {
|
|
505
|
-
var _pluginState$searchSe3;
|
|
507
|
+
var _pluginState$searchSe3, _selectedItem$prefetc;
|
|
506
508
|
|
|
507
509
|
/**
|
|
508
510
|
* When it's a mouse click even or the selectedItem.url matches displayUrl, we think
|
|
@@ -520,7 +522,8 @@ var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
520
522
|
trigger: interaction,
|
|
521
523
|
resultCount: items.length,
|
|
522
524
|
selectedResultId: selectedItem.objectId,
|
|
523
|
-
selectedRelativePosition: selectedIndex
|
|
525
|
+
selectedRelativePosition: selectedIndex,
|
|
526
|
+
prefetch: (_selectedItem$prefetc = selectedItem.prefetch) !== null && _selectedItem$prefetc !== void 0 ? _selectedItem$prefetc : false
|
|
524
527
|
},
|
|
525
528
|
eventType: _analytics.EVENT_TYPE.UI
|
|
526
529
|
});
|
|
@@ -5,52 +5,25 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getLinkMatch = getLinkMatch;
|
|
9
8
|
exports.normalizeUrl = normalizeUrl;
|
|
10
9
|
exports.linkifyContent = linkifyContent;
|
|
11
10
|
exports.getLinkDomain = getLinkDomain;
|
|
12
11
|
exports.isFromCurrentDomain = isFromCurrentDomain;
|
|
13
|
-
exports.
|
|
12
|
+
exports.LinkMatcher = void 0;
|
|
14
13
|
|
|
15
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
16
15
|
|
|
17
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
18
17
|
|
|
19
|
-
var _linkifyIt = _interopRequireDefault(require("linkify-it"));
|
|
20
|
-
|
|
21
18
|
var _slice = require("../../utils/slice");
|
|
22
19
|
|
|
23
20
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
24
21
|
|
|
25
|
-
var LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
|
|
26
|
-
exports.LINK_REGEXP = LINK_REGEXP;
|
|
27
|
-
var linkify = (0, _linkifyIt.default)();
|
|
28
|
-
linkify.add('sourcetree:', 'http:');
|
|
29
|
-
var tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
|
30
|
-
var tlds2Char = 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
|
|
31
|
-
tlds.push(tlds2Char);
|
|
32
|
-
linkify.tlds(tlds, false);
|
|
33
|
-
|
|
34
|
-
function getLinkMatch(str) {
|
|
35
|
-
if (!str) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var match = linkifyMatch(str);
|
|
40
|
-
|
|
41
|
-
if (!match.length) {
|
|
42
|
-
match = linkify.match(str);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return match && match[0];
|
|
46
|
-
}
|
|
47
22
|
/**
|
|
48
23
|
* Instance of class LinkMatcher are used in autoformatting in place of Regex.
|
|
49
24
|
* Hence it has been made similar to regex with an exec method.
|
|
50
25
|
* Extending it directly from class Regex was introducing some issues, thus that has been avoided.
|
|
51
26
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
27
|
var LinkMatcher = /*#__PURE__*/function () {
|
|
55
28
|
function LinkMatcher() {
|
|
56
29
|
(0, _classCallCheck2.default)(this, LinkMatcher);
|
|
@@ -75,7 +48,7 @@ var LinkMatcher = /*#__PURE__*/function () {
|
|
|
75
48
|
return null;
|
|
76
49
|
}
|
|
77
50
|
|
|
78
|
-
var links = linkify.match(lastStringBeforeSpace);
|
|
51
|
+
var links = _adfSchema.linkify.match(lastStringBeforeSpace);
|
|
79
52
|
|
|
80
53
|
if (!links || links.length === 0) {
|
|
81
54
|
return null;
|
|
@@ -122,8 +95,7 @@ function normalizeUrl(url) {
|
|
|
122
95
|
return url;
|
|
123
96
|
}
|
|
124
97
|
|
|
125
|
-
|
|
126
|
-
return match && match.url || '';
|
|
98
|
+
return (0, _adfSchema.normalizeUrl)(url);
|
|
127
99
|
}
|
|
128
100
|
|
|
129
101
|
function linkifyContent(schema) {
|
|
@@ -180,7 +152,8 @@ function isFromCurrentDomain(url) {
|
|
|
180
152
|
|
|
181
153
|
function findLinkMatches(text) {
|
|
182
154
|
var matches = [];
|
|
183
|
-
|
|
155
|
+
|
|
156
|
+
var linkMatches = text && _adfSchema.linkify.match(text);
|
|
184
157
|
|
|
185
158
|
if (linkMatches && linkMatches.length > 0) {
|
|
186
159
|
linkMatches.forEach(function (match) {
|
|
@@ -194,40 +167,4 @@ function findLinkMatches(text) {
|
|
|
194
167
|
}
|
|
195
168
|
|
|
196
169
|
return matches;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
var linkifyMatch = function linkifyMatch(text) {
|
|
200
|
-
var matches = [];
|
|
201
|
-
|
|
202
|
-
if (!LINK_REGEXP.test(text)) {
|
|
203
|
-
return matches;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
var startpos = 0;
|
|
207
|
-
var substr;
|
|
208
|
-
|
|
209
|
-
while (substr = text.substr(startpos)) {
|
|
210
|
-
var link = (substr.match(LINK_REGEXP) || [''])[0];
|
|
211
|
-
|
|
212
|
-
if (link) {
|
|
213
|
-
var index = substr.search(LINK_REGEXP);
|
|
214
|
-
var start = index >= 0 ? index + startpos : index;
|
|
215
|
-
var end = start + link.length;
|
|
216
|
-
matches.push({
|
|
217
|
-
index: start,
|
|
218
|
-
lastIndex: end,
|
|
219
|
-
raw: link,
|
|
220
|
-
url: link,
|
|
221
|
-
text: link,
|
|
222
|
-
schema: ''
|
|
223
|
-
});
|
|
224
|
-
startpos += end;
|
|
225
|
-
} else {
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return matches;
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
exports.linkifyMatch = linkifyMatch;
|
|
170
|
+
}
|
|
@@ -391,6 +391,12 @@ Object.defineProperty(exports, "viewUpdateSubscriptionPlugin", {
|
|
|
391
391
|
return _viewUpdateSubscription.default;
|
|
392
392
|
}
|
|
393
393
|
});
|
|
394
|
+
Object.defineProperty(exports, "codeBidiWarningPlugin", {
|
|
395
|
+
enumerable: true,
|
|
396
|
+
get: function get() {
|
|
397
|
+
return _codeBidiWarning.default;
|
|
398
|
+
}
|
|
399
|
+
});
|
|
394
400
|
|
|
395
401
|
var _base = _interopRequireDefault(require("./base"));
|
|
396
402
|
|
|
@@ -516,6 +522,8 @@ var _avatarGroup = _interopRequireDefault(require("./avatar-group"));
|
|
|
516
522
|
|
|
517
523
|
var _viewUpdateSubscription = _interopRequireDefault(require("./view-update-subscription"));
|
|
518
524
|
|
|
525
|
+
var _codeBidiWarning = _interopRequireDefault(require("./code-bidi-warning"));
|
|
526
|
+
|
|
519
527
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
520
528
|
|
|
521
529
|
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; }
|
|
@@ -59,6 +59,8 @@ var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
|
59
59
|
|
|
60
60
|
var _mediaNodeView = require("./nodeviews/mediaNodeView");
|
|
61
61
|
|
|
62
|
+
var _mediaInline = require("./nodeviews/mediaInline");
|
|
63
|
+
|
|
62
64
|
var _mediaSingle2 = require("./utils/media-single");
|
|
63
65
|
|
|
64
66
|
var mediaPlugin = function mediaPlugin(options) {
|
|
@@ -70,6 +72,8 @@ var mediaPlugin = function mediaPlugin(options) {
|
|
|
70
72
|
allowMediaGroup = _ref$allowMediaGroup === void 0 ? true : _ref$allowMediaGroup,
|
|
71
73
|
_ref$allowMediaSingle = _ref.allowMediaSingle,
|
|
72
74
|
allowMediaSingle = _ref$allowMediaSingle === void 0 ? false : _ref$allowMediaSingle,
|
|
75
|
+
_ref$allowMediaInline = _ref.allowMediaInline,
|
|
76
|
+
allowMediaInline = _ref$allowMediaInline === void 0 ? false : _ref$allowMediaInline,
|
|
73
77
|
featureFlags = _ref.featureFlags;
|
|
74
78
|
|
|
75
79
|
var captions = (0, _mediaCommon.getMediaFeatureFlag)('captions', featureFlags);
|
|
@@ -83,6 +87,9 @@ var mediaPlugin = function mediaPlugin(options) {
|
|
|
83
87
|
}, {
|
|
84
88
|
name: 'media',
|
|
85
89
|
node: _adfSchema.media
|
|
90
|
+
}, {
|
|
91
|
+
name: 'mediaInline',
|
|
92
|
+
node: _adfSchema.mediaInline
|
|
86
93
|
}].filter(function (node) {
|
|
87
94
|
if (node.name === 'mediaGroup') {
|
|
88
95
|
return allowMediaGroup;
|
|
@@ -92,6 +99,10 @@ var mediaPlugin = function mediaPlugin(options) {
|
|
|
92
99
|
return allowMediaSingle;
|
|
93
100
|
}
|
|
94
101
|
|
|
102
|
+
if (node.name === 'mediaInline') {
|
|
103
|
+
return allowMediaInline;
|
|
104
|
+
}
|
|
105
|
+
|
|
95
106
|
return true;
|
|
96
107
|
});
|
|
97
108
|
},
|
|
@@ -112,7 +123,8 @@ var mediaPlugin = function mediaPlugin(options) {
|
|
|
112
123
|
nodeViews: {
|
|
113
124
|
mediaGroup: (0, _mediaGroup.ReactMediaGroupNode)(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
114
125
|
mediaSingle: (0, _mediaSingle.ReactMediaSingleNode)(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options),
|
|
115
|
-
media: (0, _mediaNodeView.ReactMediaNode)(portalProviderAPI, eventDispatcher, providerFactory, options)
|
|
126
|
+
media: (0, _mediaNodeView.ReactMediaNode)(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
127
|
+
mediaInline: (0, _mediaInline.ReactMediaInlineNode)(portalProviderAPI, eventDispatcher, providerFactory)
|
|
116
128
|
},
|
|
117
129
|
errorReporter: errorReporter,
|
|
118
130
|
uploadErrorHandler: options && options.uploadErrorHandler,
|
|
@@ -242,8 +254,7 @@ var mediaPlugin = function mediaPlugin(options) {
|
|
|
242
254
|
var pluginState = _main.stateKey.getState(state);
|
|
243
255
|
|
|
244
256
|
pluginState.showMediaPicker();
|
|
245
|
-
|
|
246
|
-
return (0, _analytics.addAnalytics)(state, tr, {
|
|
257
|
+
return (0, _analytics.addAnalytics)(state, insert(''), {
|
|
247
258
|
action: _analytics.ACTION.OPENED,
|
|
248
259
|
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
249
260
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -49,6 +49,10 @@ var _pluginKey = require("../pm-plugins/plugin-key");
|
|
|
49
49
|
|
|
50
50
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
51
51
|
|
|
52
|
+
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; }
|
|
53
|
+
|
|
54
|
+
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; }
|
|
55
|
+
|
|
52
56
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
53
57
|
|
|
54
58
|
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; } }
|
|
@@ -151,23 +155,33 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
151
155
|
// We declared this to get a fresh position every time
|
|
152
156
|
var getNodePos = function getNodePos() {
|
|
153
157
|
return getPos() + idx + 1;
|
|
158
|
+
}; // Media Inline creates a floating toolbar with the same options, excludes these options if enabled
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
var mediaInlineOptions = function mediaInlineOptions() {
|
|
162
|
+
var allowMediaInline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
163
|
+
|
|
164
|
+
if (!allowMediaInline) {
|
|
165
|
+
return {
|
|
166
|
+
shouldEnableDownloadButton: mediaOptions.enableDownloadButton,
|
|
167
|
+
actions: [{
|
|
168
|
+
handler: disabled ? function () {} : _this.mediaPluginState.handleMediaNodeRemoval.bind(null, undefined, getNodePos),
|
|
169
|
+
icon: /*#__PURE__*/_react.default.createElement(_close.default, {
|
|
170
|
+
label: "delete"
|
|
171
|
+
})
|
|
172
|
+
}]
|
|
173
|
+
};
|
|
174
|
+
}
|
|
154
175
|
};
|
|
155
176
|
|
|
156
|
-
return {
|
|
177
|
+
return _objectSpread({
|
|
157
178
|
identifier: _this.getIdentifier(item),
|
|
158
179
|
isLazy: allowLazyLoading,
|
|
159
180
|
selected: _this.isNodeSelected(getNodePos()),
|
|
160
181
|
onClick: function onClick() {
|
|
161
182
|
(0, _utils.setNodeSelection)(_this.props.view, getNodePos());
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
actions: [{
|
|
165
|
-
handler: disabled ? function () {} : _this.mediaPluginState.handleMediaNodeRemoval.bind(null, undefined, getNodePos),
|
|
166
|
-
icon: /*#__PURE__*/_react.default.createElement(_close.default, {
|
|
167
|
-
label: "delete"
|
|
168
|
-
})
|
|
169
|
-
}]
|
|
170
|
-
};
|
|
183
|
+
}
|
|
184
|
+
}, mediaInlineOptions(mediaOptions.allowMediaInline));
|
|
171
185
|
});
|
|
172
186
|
|
|
173
187
|
return /*#__PURE__*/_react.default.createElement(_mediaFilmstrip.Filmstrip, {
|