@atlaskit/editor-core 182.0.3 → 182.1.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/.eslintrc.js +2 -0
- package/CHANGELOG.md +40 -0
- package/README.md +20 -0
- package/architecture/0001-record-architecture-decisions.md +25 -0
- package/architecture/0002-deep-equality-check-for-getsharedstate.md +67 -0
- package/architecture/0003-explicit-plugin-dependencies.md +291 -0
- package/dist/cjs/actions/index.js +17 -6
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +2 -1
- package/dist/cjs/create-editor/ErrorBoundary.js +1 -16
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/cjs/editor-next/editor-internal.js +2 -1
- package/dist/cjs/editor-next/index.js +5 -1
- package/dist/cjs/editor.js +9 -5
- package/dist/cjs/keymaps/index.js +12 -0
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +5 -7
- package/dist/cjs/labs/next/presets/default.js +1 -2
- package/dist/cjs/plugins/card/index.js +16 -5
- package/dist/cjs/plugins/card/pm-plugins/actions.js +10 -1
- package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +48 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +337 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +19 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +5 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +139 -0
- package/dist/cjs/plugins/card/pm-plugins/doc.js +99 -22
- package/dist/cjs/plugins/card/pm-plugins/main.js +16 -10
- package/dist/cjs/plugins/card/pm-plugins/reducers.js +7 -0
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +3 -7
- package/dist/cjs/plugins/card/toolbar.js +18 -8
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +12 -8
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +202 -0
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +12 -4
- package/dist/cjs/plugins/card/utils.js +4 -2
- package/dist/cjs/plugins/extension/context-panel.js +3 -2
- package/dist/cjs/plugins/extension/index.js +4 -1
- package/dist/cjs/plugins/help-dialog/ui/index.js +29 -8
- package/dist/cjs/plugins/hyperlink/Toolbar.js +12 -2
- package/dist/cjs/plugins/hyperlink/commands.js +9 -5
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +4 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/index.js +5 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +25 -23
- package/dist/cjs/plugins/media/index.js +9 -5
- package/dist/cjs/plugins/media/pm-plugins/main.js +5 -4
- package/dist/cjs/plugins/media/utils/media-single.js +1 -4
- package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +2 -1
- package/dist/cjs/plugins/paste/handlers.js +5 -5
- package/dist/cjs/plugins/paste/index.js +4 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +6 -4
- package/dist/cjs/plugins/rule/commands.js +2 -2
- package/dist/cjs/plugins/rule/index.js +5 -4
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +6 -8
- package/dist/cjs/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/text-color/index.js +5 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -4
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +10 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -4
- package/dist/cjs/ui/ColorPalette/index.js +6 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +15 -10
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +3 -1
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +248 -17
- package/dist/cjs/ui/ConfigPanel/FormContent.js +12 -6
- package/dist/cjs/ui/ConfigPanel/utils.js +2 -12
- package/dist/cjs/ui/ContentStyles/index.js +2 -5
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +16 -8
- package/dist/cjs/utils/document.js +5 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +10 -4
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +2 -1
- package/dist/es2019/create-editor/ErrorBoundary.js +1 -13
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +2 -2
- package/dist/es2019/editor-next/editor-internal.js +2 -1
- package/dist/es2019/editor-next/index.js +5 -1
- package/dist/es2019/editor.js +5 -2
- package/dist/es2019/keymaps/index.js +1 -1
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +4 -6
- package/dist/es2019/labs/next/presets/default.js +1 -2
- package/dist/es2019/plugins/card/index.js +15 -5
- package/dist/es2019/plugins/card/pm-plugins/actions.js +4 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +38 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +316 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +2 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +124 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +94 -20
- package/dist/es2019/plugins/card/pm-plugins/main.js +17 -8
- package/dist/es2019/plugins/card/pm-plugins/reducers.js +8 -0
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +3 -7
- package/dist/es2019/plugins/card/toolbar.js +16 -8
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +13 -9
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +180 -0
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +11 -2
- package/dist/es2019/plugins/card/utils.js +6 -2
- package/dist/es2019/plugins/extension/context-panel.js +3 -2
- package/dist/es2019/plugins/extension/index.js +45 -41
- package/dist/es2019/plugins/help-dialog/ui/index.js +17 -1
- package/dist/es2019/plugins/hyperlink/Toolbar.js +13 -4
- package/dist/es2019/plugins/hyperlink/commands.js +9 -6
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +4 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/index.js +96 -91
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/es2019/plugins/media/index.js +202 -198
- package/dist/es2019/plugins/media/pm-plugins/main.js +5 -4
- package/dist/es2019/plugins/media/utils/media-single.js +1 -5
- package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +3 -2
- package/dist/es2019/plugins/paste/handlers.js +6 -6
- package/dist/es2019/plugins/paste/index.js +18 -14
- package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -5
- package/dist/es2019/plugins/rule/commands.js +2 -2
- package/dist/es2019/plugins/rule/index.js +49 -46
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +6 -7
- package/dist/es2019/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/text-color/index.js +49 -44
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +10 -0
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -4
- package/dist/es2019/ui/ColorPalette/index.js +2 -2
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +8 -4
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +3 -1
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +238 -13
- package/dist/es2019/ui/ConfigPanel/FormContent.js +12 -6
- package/dist/es2019/ui/ConfigPanel/utils.js +1 -11
- package/dist/es2019/ui/ContentStyles/index.js +2 -5
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +12 -10
- package/dist/es2019/utils/document.js +5 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +17 -6
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +2 -1
- package/dist/esm/create-editor/ErrorBoundary.js +1 -16
- package/dist/esm/create-editor/ReactEditorViewInternal.js +2 -2
- package/dist/esm/editor-next/editor-internal.js +2 -1
- package/dist/esm/editor-next/index.js +5 -1
- package/dist/esm/editor.js +9 -5
- package/dist/esm/keymaps/index.js +1 -1
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +4 -6
- package/dist/esm/labs/next/presets/default.js +1 -2
- package/dist/esm/plugins/card/index.js +13 -5
- package/dist/esm/plugins/card/pm-plugins/actions.js +8 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +41 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +328 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/index.js +2 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/types.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +124 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +98 -22
- package/dist/esm/plugins/card/pm-plugins/main.js +16 -10
- package/dist/esm/plugins/card/pm-plugins/reducers.js +7 -0
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +3 -7
- package/dist/esm/plugins/card/toolbar.js +18 -8
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +13 -9
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +191 -0
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +12 -4
- package/dist/esm/plugins/card/utils.js +4 -2
- package/dist/esm/plugins/extension/context-panel.js +3 -2
- package/dist/esm/plugins/extension/index.js +4 -1
- package/dist/esm/plugins/help-dialog/ui/index.js +29 -8
- package/dist/esm/plugins/hyperlink/Toolbar.js +13 -3
- package/dist/esm/plugins/hyperlink/commands.js +9 -5
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +4 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +5 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +25 -23
- package/dist/esm/plugins/media/index.js +9 -5
- package/dist/esm/plugins/media/pm-plugins/main.js +5 -4
- package/dist/esm/plugins/media/utils/media-single.js +1 -4
- package/dist/esm/plugins/panel/pm-plugins/keymaps.js +3 -2
- package/dist/esm/plugins/paste/handlers.js +6 -6
- package/dist/esm/plugins/paste/index.js +4 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +7 -5
- package/dist/esm/plugins/rule/commands.js +2 -2
- package/dist/esm/plugins/rule/index.js +5 -4
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +6 -8
- package/dist/esm/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/text-color/index.js +5 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -4
- package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +10 -0
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -4
- package/dist/esm/ui/ColorPalette/index.js +2 -2
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +15 -10
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +3 -1
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +244 -19
- package/dist/esm/ui/ConfigPanel/FormContent.js +12 -6
- package/dist/esm/ui/ConfigPanel/utils.js +0 -10
- package/dist/esm/ui/ContentStyles/index.js +2 -5
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +16 -8
- package/dist/esm/utils/document.js +5 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +3 -2
- package/dist/types/create-editor/ErrorBoundary.d.ts +2 -2
- package/dist/types/editor-next/index.d.ts +1 -0
- package/dist/types/editor.d.ts +1 -0
- package/dist/types/keymaps/index.d.ts +1 -1
- package/dist/types/labs/next/internal/hooks/use-editor/index.d.ts +2 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +1 -5
- package/dist/types/labs/next/presets/default.d.ts +2 -10
- package/dist/types/labs/next/presets/mobile.d.ts +1 -5
- package/dist/types/plugins/card/pm-plugins/actions.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +10 -0
- package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +17 -0
- package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +2 -0
- package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +10 -0
- package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +26 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +8 -7
- package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -2
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +3 -0
- package/dist/types/plugins/card/types.d.ts +81 -7
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +2 -1
- package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +18 -0
- package/dist/types/plugins/card/utils.d.ts +1 -1
- package/dist/types/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +2 -0
- package/dist/types/plugins/hyperlink/commands.d.ts +3 -2
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +2 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/index.d.ts +2 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +2 -1
- package/dist/types/plugins/media/index.d.ts +2 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
- package/dist/types/plugins/paste/index.d.ts +2 -0
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/rule/commands.d.ts +2 -1
- package/dist/types/plugins/rule/index.d.ts +5 -1
- package/dist/types/plugins/rule/pm-plugins/input-rule.d.ts +1 -1
- package/dist/types/plugins/rule/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/text-color/index.d.ts +2 -0
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +10 -0
- package/dist/types/types/editor-appearance-component.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +2 -0
- package/dist/types/ui/ColorPalette/index.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +3 -1
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +3 -1
- package/dist/types/ui/ConfigPanel/Fields/ColorPicker.d.ts +12 -1
- package/dist/types/ui/ConfigPanel/FormContent.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/types.d.ts +3 -0
- package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/package.json +14 -13
- package/report.api.md +10 -0
- package/dist/cjs/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +0 -12
- package/dist/cjs/plugins/feature-flags-context/get-feature-flags.js +0 -11
- package/dist/cjs/plugins/feature-flags-context/index.js +0 -50
- package/dist/cjs/plugins/feature-flags-context/plugin-key.js +0 -9
- package/dist/es2019/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +0 -1
- package/dist/es2019/plugins/feature-flags-context/get-feature-flags.js +0 -2
- package/dist/es2019/plugins/feature-flags-context/index.js +0 -29
- package/dist/es2019/plugins/feature-flags-context/plugin-key.js +0 -2
- package/dist/esm/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +0 -1
- package/dist/esm/plugins/feature-flags-context/get-feature-flags.js +0 -4
- package/dist/esm/plugins/feature-flags-context/index.js +0 -40
- package/dist/esm/plugins/feature-flags-context/plugin-key.js +0 -2
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +0 -1
- package/dist/types/plugins/feature-flags-context/get-feature-flags.d.ts +0 -3
- package/dist/types/plugins/feature-flags-context/index.d.ts +0 -9
- package/dist/types/plugins/feature-flags-context/plugin-key.d.ts +0 -2
|
@@ -5,50 +5,53 @@ import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
|
5
5
|
import { IconDivider } from '../quick-insert/assets';
|
|
6
6
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
7
7
|
import keymapPlugin from './pm-plugins/keymap';
|
|
8
|
-
const rulePlugin = () =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
8
|
+
const rulePlugin = (_, api) => {
|
|
9
|
+
var _api$dependencies, _api$dependencies$fea;
|
|
10
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
11
|
+
return {
|
|
12
|
+
name: 'rule',
|
|
13
|
+
nodes() {
|
|
14
|
+
return [{
|
|
15
|
+
name: 'rule',
|
|
16
|
+
node: rule
|
|
17
|
+
}];
|
|
18
|
+
},
|
|
19
|
+
pmPlugins() {
|
|
20
|
+
return [{
|
|
21
|
+
name: 'ruleInputRule',
|
|
22
|
+
plugin: ({
|
|
23
|
+
schema
|
|
24
|
+
}) => inputRulePlugin(schema, featureFlags)
|
|
25
|
+
}, {
|
|
26
|
+
name: 'ruleKeymap',
|
|
27
|
+
plugin: () => keymapPlugin(featureFlags)
|
|
28
|
+
}];
|
|
29
|
+
},
|
|
30
|
+
pluginsOptions: {
|
|
31
|
+
quickInsert: ({
|
|
32
|
+
formatMessage
|
|
33
|
+
}) => [{
|
|
34
|
+
id: 'rule',
|
|
35
|
+
title: formatMessage(messages.horizontalRule),
|
|
36
|
+
description: formatMessage(messages.horizontalRuleDescription),
|
|
37
|
+
keywords: ['horizontal', 'rule', 'line', 'hr'],
|
|
38
|
+
priority: 1200,
|
|
39
|
+
keyshortcut: '---',
|
|
40
|
+
icon: () => /*#__PURE__*/React.createElement(IconDivider, null),
|
|
41
|
+
action(insert, state) {
|
|
42
|
+
let tr = insert(state.schema.nodes.rule.createChecked());
|
|
43
|
+
return addAnalytics(state, tr, {
|
|
44
|
+
action: ACTION.INSERTED,
|
|
45
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
46
|
+
actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
|
|
47
|
+
attributes: {
|
|
48
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
49
|
+
},
|
|
50
|
+
eventType: EVENT_TYPE.TRACK
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}]
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
};
|
|
54
57
|
export default rulePlugin;
|
|
@@ -4,8 +4,7 @@ import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules'
|
|
|
4
4
|
import { safeInsert } from '../../../utils/insert';
|
|
5
5
|
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
|
|
7
|
-
|
|
8
|
-
export const createHorizontalRule = (state, start, end, inputMethod) => {
|
|
7
|
+
export const createHorizontalRule = (state, featureFlags, start, end, inputMethod) => {
|
|
9
8
|
if (!state.selection.empty) {
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
@@ -15,7 +14,7 @@ export const createHorizontalRule = (state, start, end, inputMethod) => {
|
|
|
15
14
|
} = state.schema.nodes;
|
|
16
15
|
const {
|
|
17
16
|
newInsertionBehaviour
|
|
18
|
-
} =
|
|
17
|
+
} = featureFlags;
|
|
19
18
|
if (newInsertionBehaviour) {
|
|
20
19
|
/**
|
|
21
20
|
* This is a workaround to get rid of the typeahead text when using quick insert
|
|
@@ -38,20 +37,20 @@ export const createHorizontalRule = (state, start, end, inputMethod) => {
|
|
|
38
37
|
eventType: EVENT_TYPE.TRACK
|
|
39
38
|
});
|
|
40
39
|
};
|
|
41
|
-
const createHorizontalRuleAutoformat = (state, start, end) => {
|
|
40
|
+
const createHorizontalRuleAutoformat = (state, featureFlags, start, end) => {
|
|
42
41
|
const {
|
|
43
42
|
listItem
|
|
44
43
|
} = state.schema.nodes;
|
|
45
44
|
if (hasParentNodeOfType(listItem)(state.selection)) {
|
|
46
45
|
return null;
|
|
47
46
|
}
|
|
48
|
-
return createHorizontalRule(state, start, end, INPUT_METHOD.FORMATTING);
|
|
47
|
+
return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING);
|
|
49
48
|
};
|
|
50
49
|
export function inputRulePlugin(schema, featureFlags) {
|
|
51
50
|
const rules = [];
|
|
52
51
|
if (schema.nodes.rule) {
|
|
53
52
|
// '---' and '***' for hr
|
|
54
|
-
rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, start, end)));
|
|
53
|
+
rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, featureFlags, start, end)));
|
|
55
54
|
|
|
56
55
|
// '---' and '***' after shift+enter for hr
|
|
57
56
|
rules.push(createRule(new RegExp(`${leafNodeReplacementCharacter}(\\-\\-\\-|\\*\\*\\*)`), (state, _match, start, end) => {
|
|
@@ -61,7 +60,7 @@ export function inputRulePlugin(schema, featureFlags) {
|
|
|
61
60
|
if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
|
|
62
61
|
return null;
|
|
63
62
|
}
|
|
64
|
-
return createHorizontalRuleAutoformat(state, start, end);
|
|
63
|
+
return createHorizontalRuleAutoformat(state, featureFlags, start, end);
|
|
65
64
|
}));
|
|
66
65
|
}
|
|
67
66
|
if (rules.length !== 0) {
|
|
@@ -2,9 +2,9 @@ import { keymap } from 'prosemirror-keymap';
|
|
|
2
2
|
import * as keymaps from '../../../keymaps';
|
|
3
3
|
import { INPUT_METHOD } from '../../analytics';
|
|
4
4
|
import { insertHorizontalRule } from '../commands';
|
|
5
|
-
export function keymapPlugin() {
|
|
5
|
+
export function keymapPlugin(featureFlags) {
|
|
6
6
|
const list = {};
|
|
7
|
-
keymaps.bindKeymapWithCommand(keymaps.insertRule.common, insertHorizontalRule(INPUT_METHOD.SHORTCUT), list);
|
|
7
|
+
keymaps.bindKeymapWithCommand(keymaps.insertRule.common, insertHorizontalRule(INPUT_METHOD.SHORTCUT, featureFlags), list);
|
|
8
8
|
keymaps.bindKeymapWithCommand(keymaps.escape.common, () => true, list);
|
|
9
9
|
return keymap(list);
|
|
10
10
|
}
|
|
@@ -9,49 +9,54 @@ const pluginConfig = textColorConfig => {
|
|
|
9
9
|
}
|
|
10
10
|
return textColorConfig;
|
|
11
11
|
};
|
|
12
|
-
const textColorPlugin = textColorConfig =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
12
|
+
const textColorPlugin = (textColorConfig, api) => {
|
|
13
|
+
var _api$dependencies, _api$dependencies$fea;
|
|
14
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
15
|
+
return {
|
|
16
|
+
name: 'textColor',
|
|
17
|
+
marks() {
|
|
18
|
+
return [{
|
|
19
|
+
name: 'textColor',
|
|
20
|
+
mark: textColor
|
|
21
|
+
}];
|
|
22
|
+
},
|
|
23
|
+
pmPlugins() {
|
|
24
|
+
return [{
|
|
25
|
+
name: 'textColor',
|
|
26
|
+
plugin: ({
|
|
27
|
+
dispatch
|
|
28
|
+
}) => createPlugin(dispatch, pluginConfig(textColorConfig))
|
|
29
|
+
}];
|
|
30
|
+
},
|
|
31
|
+
primaryToolbarComponent({
|
|
32
|
+
editorView,
|
|
33
|
+
popupsMountPoint,
|
|
34
|
+
popupsBoundariesElement,
|
|
35
|
+
popupsScrollableElement,
|
|
36
|
+
isToolbarReducedSpacing,
|
|
37
|
+
dispatchAnalyticsEvent,
|
|
38
|
+
disabled
|
|
39
|
+
}) {
|
|
40
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
41
|
+
plugins: {
|
|
42
|
+
textColor: textColorPluginKey
|
|
43
|
+
},
|
|
44
|
+
render: ({
|
|
45
|
+
textColor
|
|
46
|
+
}) => /*#__PURE__*/React.createElement(ToolbarTextColor, {
|
|
47
|
+
pluginState: textColor,
|
|
48
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
49
|
+
editorView: editorView,
|
|
50
|
+
popupsMountPoint: popupsMountPoint,
|
|
51
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
52
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
53
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
featureFlags: featureFlags
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
56
61
|
export { textColorPluginKey };
|
|
57
62
|
export default textColorPlugin;
|
|
@@ -16,7 +16,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../../
|
|
|
16
16
|
import * as commands from '../../commands/change-color';
|
|
17
17
|
import { EditorTextColorIcon } from './icon';
|
|
18
18
|
import { backgroundDisabled, textColorIconBar, textColorIconWrapper } from './styles';
|
|
19
|
-
import { getFeatureFlags } from '../../../feature-flags-context/get-feature-flags';
|
|
20
19
|
const EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
|
|
21
20
|
const EXPERIMENT_GROUP_CONTROL = 'control';
|
|
22
21
|
export const messages = defineMessages({
|
|
@@ -143,13 +142,14 @@ export class ToolbarTextColor extends React.Component {
|
|
|
143
142
|
intl: {
|
|
144
143
|
formatMessage
|
|
145
144
|
},
|
|
146
|
-
disabled
|
|
145
|
+
disabled,
|
|
146
|
+
featureFlags
|
|
147
147
|
} = this.props;
|
|
148
148
|
const labelTextColor = formatMessage(messages.textColor);
|
|
149
149
|
const palette = pluginState.palette;
|
|
150
150
|
const {
|
|
151
151
|
useSomewhatSemanticTextColorNames
|
|
152
|
-
} =
|
|
152
|
+
} = featureFlags;
|
|
153
153
|
let fitWidth;
|
|
154
154
|
if (document.body.clientWidth <= 740) {
|
|
155
155
|
// This was originally hard-coded, but moved here to a const
|
|
@@ -74,5 +74,15 @@ export const toolbarMessages = defineMessages({
|
|
|
74
74
|
id: 'fabric.editor.text.formatting.off',
|
|
75
75
|
defaultMessage: 'Text formatting Off',
|
|
76
76
|
description: 'Reports that text formatting has been turned off'
|
|
77
|
+
},
|
|
78
|
+
navigateToEditorToolbar: {
|
|
79
|
+
id: 'fabric.editor.navigate.toolbar.editor',
|
|
80
|
+
defaultMessage: 'Navigate to editor toolbar',
|
|
81
|
+
description: 'Navigate to the main editor toolbar.'
|
|
82
|
+
},
|
|
83
|
+
navigateToFloatingToolbar: {
|
|
84
|
+
id: 'fabric.editor.navigate.toolbar.floating',
|
|
85
|
+
defaultMessage: 'Navigate to floating toolbar',
|
|
86
|
+
description: 'Navigate to a floating toolbar for relevant nodes (e.g. tables or panels).'
|
|
77
87
|
}
|
|
78
88
|
});
|
|
@@ -8,7 +8,6 @@ import { fullPageEditorWrapper } from './StyledComponents';
|
|
|
8
8
|
import { ContextPanelWidthProvider } from '../../ContextPanel/context';
|
|
9
9
|
import { FullPageContentArea } from './FullPageContentArea';
|
|
10
10
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
11
|
-
import { getFeatureFlags } from '../../../plugins/feature-flags-context';
|
|
12
11
|
export class FullPageEditor extends React.Component {
|
|
13
12
|
// Wrapper container for toolbar and content area
|
|
14
13
|
|
|
@@ -53,6 +52,7 @@ export class FullPageEditor extends React.Component {
|
|
|
53
52
|
_defineProperty(this, "handleResize", () => {
|
|
54
53
|
this.updateToolbarKeyline();
|
|
55
54
|
});
|
|
55
|
+
this.featureFlags = props.featureFlags;
|
|
56
56
|
if (props.innerRef) {
|
|
57
57
|
this.wrapperElementRef = props.innerRef;
|
|
58
58
|
}
|
|
@@ -65,14 +65,12 @@ export class FullPageEditor extends React.Component {
|
|
|
65
65
|
this.updateToolbarKeyline.cancel();
|
|
66
66
|
}
|
|
67
67
|
render() {
|
|
68
|
-
var _props$editorView;
|
|
69
68
|
const {
|
|
70
69
|
props
|
|
71
70
|
} = this;
|
|
72
71
|
const {
|
|
73
72
|
showKeyline
|
|
74
73
|
} = this.state;
|
|
75
|
-
const featureFlags = (_props$editorView = props.editorView) !== null && _props$editorView !== void 0 && _props$editorView.state ? getFeatureFlags(props.editorView.state) : undefined;
|
|
76
74
|
return jsx(ContextPanelWidthProvider, null, jsx("div", {
|
|
77
75
|
css: fullPageEditorWrapper,
|
|
78
76
|
className: "akEditor",
|
|
@@ -96,7 +94,7 @@ export class FullPageEditor extends React.Component {
|
|
|
96
94
|
primaryToolbarComponents: props.primaryToolbarComponents,
|
|
97
95
|
providerFactory: props.providerFactory,
|
|
98
96
|
showKeyline: showKeyline,
|
|
99
|
-
featureFlags: featureFlags
|
|
97
|
+
featureFlags: this.featureFlags
|
|
100
98
|
}), jsx(FullPageContentArea, {
|
|
101
99
|
appearance: props.appearance,
|
|
102
100
|
contentArea: this.contentArea,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ColorPalette, backgroundPaletteTooltipMessages, textPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
2
|
-
export { ColorPalette, backgroundPaletteTooltipMessages, textPaletteTooltipMessages };
|
|
1
|
+
import { ColorPalette, backgroundPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
2
|
+
export { ColorPalette, backgroundPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages };
|
|
3
3
|
export default ColorPalette;
|
|
@@ -34,7 +34,8 @@ function ConfigForm({
|
|
|
34
34
|
onFieldChange,
|
|
35
35
|
parameters,
|
|
36
36
|
submitting,
|
|
37
|
-
contextIdentifierProvider
|
|
37
|
+
contextIdentifierProvider,
|
|
38
|
+
featureFlags
|
|
38
39
|
}) {
|
|
39
40
|
useEffect(() => {
|
|
40
41
|
if (fields) {
|
|
@@ -58,7 +59,8 @@ function ConfigForm({
|
|
|
58
59
|
extensionManifest: extensionManifest,
|
|
59
60
|
onFieldChange: onFieldChange,
|
|
60
61
|
firstVisibleFieldName: firstVisibleFieldName,
|
|
61
|
-
contextIdentifierProvider: contextIdentifierProvider
|
|
62
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
63
|
+
featureFlags: featureFlags
|
|
62
64
|
}), /*#__PURE__*/React.createElement("div", {
|
|
63
65
|
style: canSave ? {} : {
|
|
64
66
|
display: 'none'
|
|
@@ -325,7 +327,8 @@ class ConfigPanel extends React.Component {
|
|
|
325
327
|
// memoized to prevent rerender on new parameters
|
|
326
328
|
render() {
|
|
327
329
|
const {
|
|
328
|
-
extensionManifest
|
|
330
|
+
extensionManifest,
|
|
331
|
+
featureFlags
|
|
329
332
|
} = this.props;
|
|
330
333
|
if (!extensionManifest) {
|
|
331
334
|
return /*#__PURE__*/React.createElement(LoadingState, null);
|
|
@@ -385,7 +388,8 @@ class ConfigPanel extends React.Component {
|
|
|
385
388
|
onFieldChange: onFieldChange,
|
|
386
389
|
parameters: currentParameters,
|
|
387
390
|
submitting: submitting,
|
|
388
|
-
contextIdentifierProvider: extension === null || extension === void 0 ? void 0 : extension.contextIdentifierProvider
|
|
391
|
+
contextIdentifierProvider: extension === null || extension === void 0 ? void 0 : extension.contextIdentifierProvider,
|
|
392
|
+
featureFlags: featureFlags
|
|
389
393
|
}))
|
|
390
394
|
}));
|
|
391
395
|
});
|
|
@@ -71,6 +71,7 @@ export default function FieldsLoader({
|
|
|
71
71
|
autoSaveReject,
|
|
72
72
|
closeOnEsc,
|
|
73
73
|
showHeader,
|
|
74
|
+
featureFlags,
|
|
74
75
|
onChange,
|
|
75
76
|
onCancel
|
|
76
77
|
}) {
|
|
@@ -93,6 +94,7 @@ export default function FieldsLoader({
|
|
|
93
94
|
showHeader: showHeader,
|
|
94
95
|
onChange: onChange,
|
|
95
96
|
onCancel: onCancel,
|
|
96
|
-
errorMessage: errorMessage
|
|
97
|
+
errorMessage: errorMessage,
|
|
98
|
+
featureFlags: featureFlags
|
|
97
99
|
}));
|
|
98
100
|
}
|