@atlaskit/editor-plugin-extension 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +26 -0
- package/CHANGELOG.md +16 -0
- package/dist/cjs/actions.js +236 -0
- package/dist/cjs/commands.js +122 -0
- package/dist/cjs/context-panel.js +269 -0
- package/dist/cjs/extension-api.js +266 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/plugin-factory.js +32 -0
- package/dist/cjs/plugin-key.js +8 -0
- package/dist/cjs/plugin.js +147 -0
- package/dist/cjs/pm-plugins/keymap.js +21 -0
- package/dist/cjs/pm-plugins/macro/actions.js +186 -0
- package/dist/cjs/pm-plugins/macro/index.js +72 -0
- package/dist/cjs/pm-plugins/macro/plugin-key.js +8 -0
- package/dist/cjs/pm-plugins/macro/types.js +5 -0
- package/dist/cjs/pm-plugins/main.js +323 -0
- package/dist/cjs/pm-plugins/unique-id.js +80 -0
- package/dist/cjs/pm-plugins/utils.js +75 -0
- package/dist/cjs/reducer.js +18 -0
- package/dist/cjs/toolbar.js +242 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +475 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +122 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanelLoader.js +23 -0
- package/dist/cjs/ui/ConfigPanel/ErrorMessage/ErrorImage.js +76 -0
- package/dist/cjs/ui/ConfigPanel/ErrorMessage/index.js +33 -0
- package/dist/cjs/ui/ConfigPanel/FieldMessages.js +105 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Boolean.js +150 -0
- package/dist/cjs/ui/ConfigPanel/Fields/CheckboxGroup.js +101 -0
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +420 -0
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +192 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Date.js +55 -0
- package/dist/cjs/ui/ConfigPanel/Fields/DateRange.js +160 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Enum.js +41 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +88 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +270 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Number.js +64 -0
- package/dist/cjs/ui/ConfigPanel/Fields/RadioGroup.js +56 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Select.js +60 -0
- package/dist/cjs/ui/ConfigPanel/Fields/SelectItem.js +53 -0
- package/dist/cjs/ui/ConfigPanel/Fields/String.js +75 -0
- package/dist/cjs/ui/ConfigPanel/Fields/TabGroup.js +73 -0
- package/dist/cjs/ui/ConfigPanel/Fields/UnhandledType.js +19 -0
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +268 -0
- package/dist/cjs/ui/ConfigPanel/Fields/common/RequiredIndicator.js +12 -0
- package/dist/cjs/ui/ConfigPanel/FormContent.js +231 -0
- package/dist/cjs/ui/ConfigPanel/FormErrorBoundary.js +140 -0
- package/dist/cjs/ui/ConfigPanel/Header.js +148 -0
- package/dist/cjs/ui/ConfigPanel/LoadingState.js +25 -0
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +61 -0
- package/dist/cjs/ui/ConfigPanel/constants.js +13 -0
- package/dist/cjs/ui/ConfigPanel/index.js +9 -0
- package/dist/cjs/ui/ConfigPanel/messages.js +99 -0
- package/dist/cjs/ui/ConfigPanel/transformers.js +631 -0
- package/dist/cjs/ui/ConfigPanel/types.js +15 -0
- package/dist/cjs/ui/ConfigPanel/use-abortable-effect/index.js +56 -0
- package/dist/cjs/ui/ConfigPanel/use-state-from-promise/index.js +41 -0
- package/dist/cjs/ui/ConfigPanel/utils.js +116 -0
- package/dist/cjs/ui/SaveIndicator/SaveIndicator.js +79 -0
- package/dist/cjs/ui/SaveIndicator/messages.js +14 -0
- package/dist/cjs/ui/SaveIndicator/types.js +5 -0
- package/dist/cjs/utils.js +73 -0
- package/dist/es2019/actions.js +203 -0
- package/dist/es2019/commands.js +99 -0
- package/dist/es2019/context-panel.js +181 -0
- package/dist/es2019/extension-api.js +284 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugin-factory.js +26 -0
- package/dist/es2019/plugin-key.js +2 -0
- package/dist/es2019/plugin.js +138 -0
- package/dist/es2019/pm-plugins/keymap.js +15 -0
- package/dist/es2019/pm-plugins/macro/actions.js +152 -0
- package/dist/es2019/pm-plugins/macro/index.js +36 -0
- package/dist/es2019/pm-plugins/macro/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/macro/types.js +1 -0
- package/dist/es2019/pm-plugins/main.js +230 -0
- package/dist/es2019/pm-plugins/unique-id.js +69 -0
- package/dist/es2019/pm-plugins/utils.js +30 -0
- package/dist/es2019/reducer.js +11 -0
- package/dist/es2019/toolbar.js +236 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +415 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +100 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanelLoader.js +7 -0
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/ErrorImage.js +66 -0
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/index.js +25 -0
- package/dist/es2019/ui/ConfigPanel/FieldMessages.js +101 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Boolean.js +138 -0
- package/dist/es2019/ui/ConfigPanel/Fields/CheckboxGroup.js +96 -0
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +411 -0
- package/dist/es2019/ui/ConfigPanel/Fields/CustomSelect.js +132 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Date.js +50 -0
- package/dist/es2019/ui/ConfigPanel/Fields/DateRange.js +139 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Enum.js +35 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +73 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +227 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Number.js +61 -0
- package/dist/es2019/ui/ConfigPanel/Fields/RadioGroup.js +40 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Select.js +50 -0
- package/dist/es2019/ui/ConfigPanel/Fields/SelectItem.js +47 -0
- package/dist/es2019/ui/ConfigPanel/Fields/String.js +67 -0
- package/dist/es2019/ui/ConfigPanel/Fields/TabGroup.js +57 -0
- package/dist/es2019/ui/ConfigPanel/Fields/UnhandledType.js +11 -0
- package/dist/es2019/ui/ConfigPanel/Fields/UserSelect.js +194 -0
- package/dist/es2019/ui/ConfigPanel/Fields/common/RequiredIndicator.js +5 -0
- package/dist/es2019/ui/ConfigPanel/FormContent.js +225 -0
- package/dist/es2019/ui/ConfigPanel/FormErrorBoundary.js +100 -0
- package/dist/es2019/ui/ConfigPanel/Header.js +140 -0
- package/dist/es2019/ui/ConfigPanel/LoadingState.js +15 -0
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +52 -0
- package/dist/es2019/ui/ConfigPanel/constants.js +7 -0
- package/dist/es2019/ui/ConfigPanel/index.js +2 -0
- package/dist/es2019/ui/ConfigPanel/messages.js +93 -0
- package/dist/es2019/ui/ConfigPanel/transformers.js +367 -0
- package/dist/es2019/ui/ConfigPanel/types.js +9 -0
- package/dist/es2019/ui/ConfigPanel/use-abortable-effect/index.js +46 -0
- package/dist/es2019/ui/ConfigPanel/use-state-from-promise/index.js +30 -0
- package/dist/es2019/ui/ConfigPanel/utils.js +86 -0
- package/dist/es2019/ui/SaveIndicator/SaveIndicator.js +66 -0
- package/dist/es2019/ui/SaveIndicator/messages.js +8 -0
- package/dist/es2019/ui/SaveIndicator/types.js +1 -0
- package/dist/es2019/utils.js +65 -0
- package/dist/esm/actions.js +223 -0
- package/dist/esm/commands.js +113 -0
- package/dist/esm/context-panel.js +261 -0
- package/dist/esm/extension-api.js +259 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugin-factory.js +25 -0
- package/dist/esm/plugin-key.js +2 -0
- package/dist/esm/plugin.js +140 -0
- package/dist/esm/pm-plugins/keymap.js +15 -0
- package/dist/esm/pm-plugins/macro/actions.js +179 -0
- package/dist/esm/pm-plugins/macro/index.js +42 -0
- package/dist/esm/pm-plugins/macro/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/macro/types.js +1 -0
- package/dist/esm/pm-plugins/main.js +298 -0
- package/dist/esm/pm-plugins/unique-id.js +74 -0
- package/dist/esm/pm-plugins/utils.js +68 -0
- package/dist/esm/reducer.js +11 -0
- package/dist/esm/toolbar.js +235 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +465 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +112 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanelLoader.js +11 -0
- package/dist/esm/ui/ConfigPanel/ErrorMessage/ErrorImage.js +68 -0
- package/dist/esm/ui/ConfigPanel/ErrorMessage/index.js +26 -0
- package/dist/esm/ui/ConfigPanel/FieldMessages.js +97 -0
- package/dist/esm/ui/ConfigPanel/Fields/Boolean.js +140 -0
- package/dist/esm/ui/ConfigPanel/Fields/CheckboxGroup.js +95 -0
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +414 -0
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +182 -0
- package/dist/esm/ui/ConfigPanel/Fields/Date.js +48 -0
- package/dist/esm/ui/ConfigPanel/Fields/DateRange.js +154 -0
- package/dist/esm/ui/ConfigPanel/Fields/Enum.js +34 -0
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +77 -0
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +261 -0
- package/dist/esm/ui/ConfigPanel/Fields/Number.js +57 -0
- package/dist/esm/ui/ConfigPanel/Fields/RadioGroup.js +46 -0
- package/dist/esm/ui/ConfigPanel/Fields/Select.js +50 -0
- package/dist/esm/ui/ConfigPanel/Fields/SelectItem.js +45 -0
- package/dist/esm/ui/ConfigPanel/Fields/String.js +65 -0
- package/dist/esm/ui/ConfigPanel/Fields/TabGroup.js +62 -0
- package/dist/esm/ui/ConfigPanel/Fields/UnhandledType.js +10 -0
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +258 -0
- package/dist/esm/ui/ConfigPanel/Fields/common/RequiredIndicator.js +5 -0
- package/dist/esm/ui/ConfigPanel/FormContent.js +223 -0
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +133 -0
- package/dist/esm/ui/ConfigPanel/Header.js +140 -0
- package/dist/esm/ui/ConfigPanel/LoadingState.js +17 -0
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +53 -0
- package/dist/esm/ui/ConfigPanel/constants.js +7 -0
- package/dist/esm/ui/ConfigPanel/index.js +2 -0
- package/dist/esm/ui/ConfigPanel/messages.js +93 -0
- package/dist/esm/ui/ConfigPanel/transformers.js +624 -0
- package/dist/esm/ui/ConfigPanel/types.js +9 -0
- package/dist/esm/ui/ConfigPanel/use-abortable-effect/index.js +49 -0
- package/dist/esm/ui/ConfigPanel/use-state-from-promise/index.js +34 -0
- package/dist/esm/ui/ConfigPanel/utils.js +109 -0
- package/dist/esm/ui/SaveIndicator/SaveIndicator.js +72 -0
- package/dist/esm/ui/SaveIndicator/messages.js +8 -0
- package/dist/esm/ui/SaveIndicator/types.js +1 -0
- package/dist/esm/utils.js +67 -0
- package/dist/types/actions.d.ts +20 -0
- package/dist/types/commands.d.ts +15 -0
- package/dist/types/context-panel.d.ts +10 -0
- package/dist/types/extension-api.d.ts +12 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/plugin-factory.d.ts +4 -0
- package/dist/types/plugin-key.d.ts +3 -0
- package/dist/types/plugin.d.ts +2 -0
- package/dist/types/pm-plugins/keymap.d.ts +3 -0
- package/dist/types/pm-plugins/macro/actions.d.ts +9 -0
- package/dist/types/pm-plugins/macro/index.d.ts +8 -0
- package/dist/types/pm-plugins/macro/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/macro/types.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +25 -0
- package/dist/types/pm-plugins/unique-id.d.ts +3 -0
- package/dist/types/pm-plugins/utils.d.ts +3 -0
- package/dist/types/reducer.d.ts +2 -0
- package/dist/types/toolbar.d.ts +44 -0
- package/dist/types/types.d.ts +27 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +22 -0
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +21 -0
- package/dist/types/ui/ConfigPanel/ConfigPanelLoader.d.ts +5 -0
- package/dist/types/ui/ConfigPanel/ErrorMessage/ErrorImage.d.ts +4 -0
- package/dist/types/ui/ConfigPanel/ErrorMessage/index.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/FieldMessages.d.ts +12 -0
- package/dist/types/ui/ConfigPanel/Fields/Boolean.d.ts +8 -0
- package/dist/types/ui/ConfigPanel/Fields/CheckboxGroup.d.ts +8 -0
- package/dist/types/ui/ConfigPanel/Fields/ColorPicker.d.ts +20 -0
- package/dist/types/ui/ConfigPanel/Fields/CustomSelect.d.ts +24 -0
- package/dist/types/ui/ConfigPanel/Fields/Date.d.ts +20 -0
- package/dist/types/ui/ConfigPanel/Fields/DateRange.d.ts +20 -0
- package/dist/types/ui/ConfigPanel/Fields/Enum.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +16 -0
- package/dist/types/ui/ConfigPanel/Fields/Fieldset.d.ts +19 -0
- package/dist/types/ui/ConfigPanel/Fields/Number.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/RadioGroup.d.ts +8 -0
- package/dist/types/ui/ConfigPanel/Fields/Select.d.ts +11 -0
- package/dist/types/ui/ConfigPanel/Fields/SelectItem.d.ts +5 -0
- package/dist/types/ui/ConfigPanel/Fields/String.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/TabGroup.d.ts +14 -0
- package/dist/types/ui/ConfigPanel/Fields/UnhandledType.d.ts +6 -0
- package/dist/types/ui/ConfigPanel/Fields/UserSelect.d.ts +10 -0
- package/dist/types/ui/ConfigPanel/Fields/common/RequiredIndicator.d.ts +1 -0
- package/dist/types/ui/ConfigPanel/FormContent.d.ts +4 -0
- package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +16 -0
- package/dist/types/ui/ConfigPanel/Header.d.ts +23 -0
- package/dist/types/ui/ConfigPanel/LoadingState.d.ts +4 -0
- package/dist/types/ui/ConfigPanel/NestedForms/RemovableField.d.ts +19 -0
- package/dist/types/ui/ConfigPanel/constants.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/index.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/messages.d.ts +92 -0
- package/dist/types/ui/ConfigPanel/transformers.d.ts +9 -0
- package/dist/types/ui/ConfigPanel/types.d.ts +36 -0
- package/dist/types/ui/ConfigPanel/use-abortable-effect/index.d.ts +16 -0
- package/dist/types/ui/ConfigPanel/use-state-from-promise/index.d.ts +15 -0
- package/dist/types/ui/ConfigPanel/utils.d.ts +16 -0
- package/dist/types/ui/SaveIndicator/SaveIndicator.d.ts +4 -0
- package/dist/types/ui/SaveIndicator/messages.d.ts +7 -0
- package/dist/types/ui/SaveIndicator/types.d.ts +11 -0
- package/dist/types/utils.d.ts +15 -0
- package/dist/types-ts4.5/actions.d.ts +20 -0
- package/dist/types-ts4.5/commands.d.ts +15 -0
- package/dist/types-ts4.5/context-panel.d.ts +10 -0
- package/dist/types-ts4.5/extension-api.d.ts +12 -0
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.5/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugin.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/macro/actions.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/macro/index.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/macro/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/macro/types.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +25 -0
- package/dist/types-ts4.5/pm-plugins/unique-id.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +3 -0
- package/dist/types-ts4.5/reducer.d.ts +2 -0
- package/dist/types-ts4.5/toolbar.d.ts +44 -0
- package/dist/types-ts4.5/types.d.ts +27 -2
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +22 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +21 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelLoader.d.ts +5 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ErrorMessage/ErrorImage.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfigPanel/ErrorMessage/index.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/FieldMessages.d.ts +12 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Boolean.d.ts +8 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/CheckboxGroup.d.ts +8 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/ColorPicker.d.ts +20 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/CustomSelect.d.ts +24 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Date.d.ts +20 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/DateRange.d.ts +20 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Enum.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Expand.d.ts +16 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Fieldset.d.ts +19 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Number.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/RadioGroup.d.ts +8 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Select.d.ts +11 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/SelectItem.d.ts +5 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/String.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/TabGroup.d.ts +14 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/UnhandledType.d.ts +6 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/UserSelect.d.ts +10 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/common/RequiredIndicator.d.ts +1 -0
- package/dist/types-ts4.5/ui/ConfigPanel/FormContent.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfigPanel/FormErrorBoundary.d.ts +16 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Header.d.ts +23 -0
- package/dist/types-ts4.5/ui/ConfigPanel/LoadingState.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfigPanel/NestedForms/RemovableField.d.ts +19 -0
- package/dist/types-ts4.5/ui/ConfigPanel/constants.d.ts +2 -0
- package/dist/types-ts4.5/ui/ConfigPanel/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/ConfigPanel/messages.d.ts +92 -0
- package/dist/types-ts4.5/ui/ConfigPanel/transformers.d.ts +9 -0
- package/dist/types-ts4.5/ui/ConfigPanel/types.d.ts +39 -0
- package/dist/types-ts4.5/ui/ConfigPanel/use-abortable-effect/index.d.ts +16 -0
- package/dist/types-ts4.5/ui/ConfigPanel/use-state-from-promise/index.d.ts +18 -0
- package/dist/types-ts4.5/ui/ConfigPanel/utils.d.ts +16 -0
- package/dist/types-ts4.5/ui/SaveIndicator/SaveIndicator.d.ts +4 -0
- package/dist/types-ts4.5/ui/SaveIndicator/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/SaveIndicator/types.d.ts +11 -0
- package/dist/types-ts4.5/utils.d.ts +15 -0
- package/example-utils/config-panel/ConfigPanelWithExtensionPicker.tsx +217 -0
- package/example-utils/config-panel/ConfigPanelWithProviders.tsx +51 -0
- package/example-utils/config-panel/ExtensionNodePicker.tsx +141 -0
- package/example-utils/config-panel/FieldTypePicker.tsx +63 -0
- package/example-utils/config-panel/example-manifest-all-fields.ts +86 -0
- package/example-utils/config-panel/example-manifest-individual-fields.ts +85 -0
- package/example-utils/config-panel/fields.ts +611 -0
- package/package.json +49 -7
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { bodiedExtension, extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { createEditSelectedExtensionAction } from './actions';
|
|
5
|
+
import { forceAutoSave } from './commands';
|
|
6
|
+
import { getContextPanel } from './context-panel';
|
|
7
|
+
import { createExtensionAPI } from './extension-api';
|
|
8
|
+
import keymapPlugin from './pm-plugins/keymap';
|
|
9
|
+
import { createPlugin as createMacroPlugin } from './pm-plugins/macro';
|
|
10
|
+
import { insertMacroFromMacroBrowser, runMacroAutoConvert } from './pm-plugins/macro/actions';
|
|
11
|
+
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
12
|
+
import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
13
|
+
import { getToolbarConfig } from './toolbar';
|
|
14
|
+
export var extensionPlugin = function extensionPlugin(_ref) {
|
|
15
|
+
var _api$featureFlags, _api$analytics2, _api$analytics3, _api$decorations, _api$contextPanel3, _api$analytics4, _api$contextPanel4;
|
|
16
|
+
var _ref$config = _ref.config,
|
|
17
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
18
|
+
_api = _ref.api;
|
|
19
|
+
var featureFlags = (_api === null || _api === void 0 || (_api$featureFlags = _api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
20
|
+
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
21
|
+
//This is needed to get the current selection in the editor
|
|
22
|
+
var editorViewRef = {
|
|
23
|
+
current: null
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
name: 'extension',
|
|
27
|
+
nodes: function nodes() {
|
|
28
|
+
var extensionNodes = [{
|
|
29
|
+
name: 'extension',
|
|
30
|
+
node: extension
|
|
31
|
+
}, {
|
|
32
|
+
name: 'bodiedExtension',
|
|
33
|
+
node: bodiedExtension
|
|
34
|
+
}, {
|
|
35
|
+
name: 'inlineExtension',
|
|
36
|
+
node: inlineExtension
|
|
37
|
+
}];
|
|
38
|
+
|
|
39
|
+
// Revert to returning all nodes without local variable, once FF is removed
|
|
40
|
+
if (getBooleanFF('platform.editor.multi-bodied-extension_0rygg')) {
|
|
41
|
+
extensionNodes.push({
|
|
42
|
+
name: 'extensionFrame',
|
|
43
|
+
node: extensionFrame
|
|
44
|
+
});
|
|
45
|
+
extensionNodes.push({
|
|
46
|
+
name: 'multiBodiedExtension',
|
|
47
|
+
node: multiBodiedExtension
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return extensionNodes;
|
|
51
|
+
},
|
|
52
|
+
getSharedState: function getSharedState(state) {
|
|
53
|
+
if (!state) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
var pluginState = pluginKey.getState(state);
|
|
57
|
+
return {
|
|
58
|
+
showContextPanel: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showContextPanel
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
pmPlugins: function pmPlugins() {
|
|
62
|
+
return [{
|
|
63
|
+
name: 'extension',
|
|
64
|
+
plugin: function plugin(_ref2) {
|
|
65
|
+
var dispatch = _ref2.dispatch,
|
|
66
|
+
providerFactory = _ref2.providerFactory,
|
|
67
|
+
portalProviderAPI = _ref2.portalProviderAPI,
|
|
68
|
+
eventDispatcher = _ref2.eventDispatcher;
|
|
69
|
+
var extensionHandlers = options.extensionHandlers || {};
|
|
70
|
+
return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
|
|
71
|
+
appearance: options.appearance
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
name: 'extensionKeymap',
|
|
76
|
+
plugin: function plugin() {
|
|
77
|
+
var _api$contextPanel;
|
|
78
|
+
return keymapPlugin(_api === null || _api === void 0 || (_api$contextPanel = _api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
name: 'extensionUniqueId',
|
|
82
|
+
plugin: function plugin() {
|
|
83
|
+
return createUniqueIdPlugin();
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
name: 'extensionEditorViewRef',
|
|
87
|
+
plugin: function plugin() {
|
|
88
|
+
return new SafePlugin({
|
|
89
|
+
view: function view(editorView) {
|
|
90
|
+
// Do not cleanup the editorViewRef on destroy
|
|
91
|
+
// because some functions may point to a stale
|
|
92
|
+
// reference and this means we will return null.
|
|
93
|
+
// EditorView is assumed to be stable so we do not need to
|
|
94
|
+
// cleanup.
|
|
95
|
+
// See: #hot-106316
|
|
96
|
+
editorViewRef.current = editorView;
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
name: 'macro',
|
|
103
|
+
plugin: function plugin(_ref3) {
|
|
104
|
+
var dispatch = _ref3.dispatch,
|
|
105
|
+
providerFactory = _ref3.providerFactory;
|
|
106
|
+
return createMacroPlugin(dispatch, providerFactory);
|
|
107
|
+
}
|
|
108
|
+
}];
|
|
109
|
+
},
|
|
110
|
+
actions: {
|
|
111
|
+
api: function api() {
|
|
112
|
+
var _api$contextPanel2, _api$analytics;
|
|
113
|
+
return createExtensionAPI({
|
|
114
|
+
editorView: editorViewRef.current,
|
|
115
|
+
applyChange: _api === null || _api === void 0 || (_api$contextPanel2 = _api.contextPanel) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.actions.applyChange,
|
|
116
|
+
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics = _api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
insertMacroFromMacroBrowser: insertMacroFromMacroBrowser(_api === null || _api === void 0 || (_api$analytics2 = _api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
120
|
+
editSelectedExtension: createEditSelectedExtensionAction({
|
|
121
|
+
editorViewRef: editorViewRef,
|
|
122
|
+
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics3 = _api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions
|
|
123
|
+
}),
|
|
124
|
+
runMacroAutoConvert: runMacroAutoConvert,
|
|
125
|
+
forceAutoSave: forceAutoSave
|
|
126
|
+
},
|
|
127
|
+
pluginsOptions: {
|
|
128
|
+
floatingToolbar: getToolbarConfig({
|
|
129
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
130
|
+
hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
131
|
+
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel3 = _api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange,
|
|
132
|
+
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions
|
|
133
|
+
}),
|
|
134
|
+
contextPanel: getContextPanel(function () {
|
|
135
|
+
var _editorViewRef$curren;
|
|
136
|
+
return (_editorViewRef$curren = editorViewRef.current) !== null && _editorViewRef$curren !== void 0 ? _editorViewRef$curren : undefined;
|
|
137
|
+
})(options.allowAutoSave, featureFlags, _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange)
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { bindKeymapWithCommand, escape } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
|
+
import { clearEditingContext } from '../commands';
|
|
4
|
+
import { getPluginState } from './main';
|
|
5
|
+
export default function keymapPlugin(applyChange) {
|
|
6
|
+
var list = {};
|
|
7
|
+
bindKeymapWithCommand(escape.common, function (state, dispatch) {
|
|
8
|
+
var extensionState = getPluginState(state);
|
|
9
|
+
if (!extensionState.showContextPanel) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return clearEditingContext(applyChange)(state, dispatch);
|
|
13
|
+
}, list);
|
|
14
|
+
return keymap(list);
|
|
15
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
+
import assert from 'assert';
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { normaliseNestedLayout } from '@atlaskit/editor-common/insert';
|
|
9
|
+
import { getValidNode } from '@atlaskit/editor-common/validator';
|
|
10
|
+
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
+
import { findSelectedNodeOfType, replaceParentNodeOfType, replaceSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
+
import { getPluginState as getExtensionPluginState } from '../../plugin-factory';
|
|
13
|
+
import { pluginKey } from './plugin-key';
|
|
14
|
+
export var insertMacroFromMacroBrowser = function insertMacroFromMacroBrowser(editorAnalyticsAPI) {
|
|
15
|
+
return function (macroProvider, macroNode, isEditing) {
|
|
16
|
+
return /*#__PURE__*/function () {
|
|
17
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(view) {
|
|
18
|
+
var newMacro, state, dispatch, currentLayout, node, selection, schema, _schema$nodes, extension, inlineExtension, bodiedExtension, extensionState, targetSelectionSource, tr, isBodiedExtensionSelected, pos, _macroNode$attrs, extensionType, extensionKey, layout, localId;
|
|
19
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
if (macroProvider) {
|
|
23
|
+
_context.next = 2;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
return _context.abrupt("return", false);
|
|
27
|
+
case 2:
|
|
28
|
+
_context.next = 4;
|
|
29
|
+
return macroProvider.openMacroBrowser(macroNode);
|
|
30
|
+
case 4:
|
|
31
|
+
newMacro = _context.sent;
|
|
32
|
+
if (!(newMacro && macroNode)) {
|
|
33
|
+
_context.next = 20;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
state = view.state, dispatch = view.dispatch;
|
|
37
|
+
currentLayout = macroNode && macroNode.attrs.layout || 'default';
|
|
38
|
+
node = resolveMacro(newMacro, state, {
|
|
39
|
+
layout: currentLayout
|
|
40
|
+
});
|
|
41
|
+
if (node) {
|
|
42
|
+
_context.next = 11;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return _context.abrupt("return", false);
|
|
46
|
+
case 11:
|
|
47
|
+
selection = state.selection, schema = state.schema;
|
|
48
|
+
_schema$nodes = schema.nodes, extension = _schema$nodes.extension, inlineExtension = _schema$nodes.inlineExtension, bodiedExtension = _schema$nodes.bodiedExtension;
|
|
49
|
+
extensionState = getExtensionPluginState(state);
|
|
50
|
+
targetSelectionSource = TARGET_SELECTION_SOURCE.CURRENT_SELECTION;
|
|
51
|
+
tr = state.tr;
|
|
52
|
+
isBodiedExtensionSelected = !!findSelectedNodeOfType([bodiedExtension])(selection); // When it's a bodiedExtension but not selected
|
|
53
|
+
if (macroNode.type === bodiedExtension && !isBodiedExtensionSelected) {
|
|
54
|
+
// `isEditing` is `false` when we are inserting from insert-block toolbar
|
|
55
|
+
tr = isEditing ? replaceParentNodeOfType(bodiedExtension, node)(tr) : safeInsert(node)(tr);
|
|
56
|
+
// Replacing selected node doesn't update the selection. `selection.node` still returns the old node
|
|
57
|
+
tr.setSelection(TextSelection.create(tr.doc, state.selection.anchor));
|
|
58
|
+
}
|
|
59
|
+
// If any extension is currently selected
|
|
60
|
+
else if (findSelectedNodeOfType([extension, bodiedExtension, inlineExtension])(selection)) {
|
|
61
|
+
tr = replaceSelectedNode(node)(tr);
|
|
62
|
+
// Replacing selected node doesn't update the selection. `selection.node` still returns the old node
|
|
63
|
+
tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(state.selection.anchor)));
|
|
64
|
+
}
|
|
65
|
+
// When we loose the selection. This usually happens when Synchrony resets or changes
|
|
66
|
+
// the selection when user is in the middle of updating an extension.
|
|
67
|
+
else if (extensionState.element) {
|
|
68
|
+
pos = view.posAtDOM(extensionState.element, -1);
|
|
69
|
+
if (pos > -1) {
|
|
70
|
+
tr = tr.replaceWith(pos, pos + macroNode.nodeSize, node);
|
|
71
|
+
tr.setSelection(Selection.near(tr.doc.resolve(pos)));
|
|
72
|
+
targetSelectionSource = TARGET_SELECTION_SOURCE.HTML_ELEMENT;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Only scroll if we have anything to update, best to avoid surprise scroll
|
|
77
|
+
if (dispatch && tr.docChanged) {
|
|
78
|
+
_macroNode$attrs = macroNode.attrs, extensionType = _macroNode$attrs.extensionType, extensionKey = _macroNode$attrs.extensionKey, layout = _macroNode$attrs.layout, localId = _macroNode$attrs.localId;
|
|
79
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
80
|
+
action: ACTION.UPDATED,
|
|
81
|
+
actionSubject: ACTION_SUBJECT.EXTENSION,
|
|
82
|
+
actionSubjectId: macroNode.type.name,
|
|
83
|
+
eventType: EVENT_TYPE.TRACK,
|
|
84
|
+
attributes: {
|
|
85
|
+
inputMethod: isEditing ? INPUT_METHOD.MACRO_BROWSER : INPUT_METHOD.TOOLBAR,
|
|
86
|
+
extensionType: extensionType,
|
|
87
|
+
extensionKey: extensionKey,
|
|
88
|
+
layout: layout,
|
|
89
|
+
localId: localId,
|
|
90
|
+
selection: tr.selection.toJSON(),
|
|
91
|
+
targetSelectionSource: targetSelectionSource
|
|
92
|
+
}
|
|
93
|
+
})(tr);
|
|
94
|
+
dispatch(tr.scrollIntoView());
|
|
95
|
+
}
|
|
96
|
+
return _context.abrupt("return", true);
|
|
97
|
+
case 20:
|
|
98
|
+
return _context.abrupt("return", false);
|
|
99
|
+
case 21:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
102
|
+
}
|
|
103
|
+
}, _callee);
|
|
104
|
+
}));
|
|
105
|
+
return function (_x) {
|
|
106
|
+
return _ref.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export var resolveMacro = function resolveMacro(macro, state, optionalAttrs) {
|
|
112
|
+
if (!macro || !state) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
var schema = state.schema;
|
|
116
|
+
var _getValidNode = getValidNode(macro, schema),
|
|
117
|
+
type = _getValidNode.type,
|
|
118
|
+
attrs = _getValidNode.attrs;
|
|
119
|
+
var node = null;
|
|
120
|
+
if (type === 'extension') {
|
|
121
|
+
node = schema.nodes.extension.create(_objectSpread(_objectSpread({}, attrs), optionalAttrs));
|
|
122
|
+
} else if (type === 'bodiedExtension') {
|
|
123
|
+
node = schema.nodes.bodiedExtension.create(_objectSpread(_objectSpread({}, attrs), optionalAttrs), schema.nodeFromJSON(macro).content);
|
|
124
|
+
} else if (type === 'inlineExtension') {
|
|
125
|
+
node = schema.nodes.inlineExtension.create(attrs);
|
|
126
|
+
}
|
|
127
|
+
return node && normaliseNestedLayout(state, node);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// gets the macroProvider from the state and tries to autoConvert a given text
|
|
131
|
+
export var runMacroAutoConvert = function runMacroAutoConvert(state, text) {
|
|
132
|
+
var macroPluginState = pluginKey.getState(state);
|
|
133
|
+
var macroProvider = macroPluginState && macroPluginState.macroProvider;
|
|
134
|
+
if (!macroProvider || !macroProvider.autoConvert) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
var macroAttributes = macroProvider.autoConvert(text);
|
|
138
|
+
if (!macroAttributes) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// decides which kind of macro to render (inline|bodied|bodyless)
|
|
143
|
+
return resolveMacro(macroAttributes, state);
|
|
144
|
+
};
|
|
145
|
+
export var setMacroProvider = function setMacroProvider(provider) {
|
|
146
|
+
return /*#__PURE__*/function () {
|
|
147
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(view) {
|
|
148
|
+
var resolvedProvider;
|
|
149
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
150
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
_context2.prev = 0;
|
|
153
|
+
_context2.next = 3;
|
|
154
|
+
return provider;
|
|
155
|
+
case 3:
|
|
156
|
+
resolvedProvider = _context2.sent;
|
|
157
|
+
assert(resolvedProvider && resolvedProvider.openMacroBrowser, "MacroProvider promise did not resolve to a valid instance of MacroProvider - ".concat(resolvedProvider));
|
|
158
|
+
_context2.next = 10;
|
|
159
|
+
break;
|
|
160
|
+
case 7:
|
|
161
|
+
_context2.prev = 7;
|
|
162
|
+
_context2.t0 = _context2["catch"](0);
|
|
163
|
+
resolvedProvider = null;
|
|
164
|
+
case 10:
|
|
165
|
+
view.dispatch(view.state.tr.setMeta(pluginKey, {
|
|
166
|
+
macroProvider: resolvedProvider
|
|
167
|
+
}));
|
|
168
|
+
return _context2.abrupt("return", true);
|
|
169
|
+
case 12:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context2.stop();
|
|
172
|
+
}
|
|
173
|
+
}, _callee2, null, [[0, 7]]);
|
|
174
|
+
}));
|
|
175
|
+
return function (_x2) {
|
|
176
|
+
return _ref2.apply(this, arguments);
|
|
177
|
+
};
|
|
178
|
+
}();
|
|
179
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { setMacroProvider } from './actions';
|
|
6
|
+
import { pluginKey } from './plugin-key';
|
|
7
|
+
export { insertMacroFromMacroBrowser, resolveMacro, runMacroAutoConvert, setMacroProvider } from './actions';
|
|
8
|
+
export var createPlugin = function createPlugin(dispatch, providerFactory) {
|
|
9
|
+
return new SafePlugin({
|
|
10
|
+
state: {
|
|
11
|
+
init: function init() {
|
|
12
|
+
return {
|
|
13
|
+
macroProvider: null
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
apply: function apply(tr, state) {
|
|
17
|
+
var meta = tr.getMeta(pluginKey);
|
|
18
|
+
if (meta) {
|
|
19
|
+
var newState = _objectSpread(_objectSpread({}, state), meta);
|
|
20
|
+
dispatch(pluginKey, newState);
|
|
21
|
+
return newState;
|
|
22
|
+
}
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
key: pluginKey,
|
|
27
|
+
view: function view(_view) {
|
|
28
|
+
var handleProvider = function handleProvider(_name, provider) {
|
|
29
|
+
return provider && setMacroProvider(provider)(_view);
|
|
30
|
+
};
|
|
31
|
+
// make sure editable DOM node is mounted
|
|
32
|
+
if (_view.dom.parentNode) {
|
|
33
|
+
providerFactory.subscribe('macroProvider', handleProvider);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
destroy: function destroy() {
|
|
37
|
+
providerFactory.unsubscribe('macroProvider', handleProvider);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|