@atlaskit/editor-core 149.0.0 → 150.0.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/CHANGELOG.md +41 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/editor.js +1 -4
- package/dist/cjs/i18n/cs.js +18 -2
- package/dist/cjs/i18n/da.js +18 -2
- package/dist/cjs/i18n/de.js +18 -2
- package/dist/cjs/i18n/es.js +13 -2
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +13 -2
- package/dist/cjs/i18n/fr.js +13 -2
- package/dist/cjs/i18n/hu.js +14 -3
- package/dist/cjs/i18n/it.js +18 -2
- package/dist/cjs/i18n/ja.js +13 -2
- package/dist/cjs/i18n/ko.js +13 -2
- package/dist/cjs/i18n/nb.js +13 -2
- package/dist/cjs/i18n/nl.js +18 -2
- package/dist/cjs/i18n/pl.js +16 -2
- package/dist/cjs/i18n/pt_BR.js +14 -3
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ru.js +13 -2
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +18 -2
- package/dist/cjs/i18n/th.js +18 -2
- package/dist/cjs/i18n/tr.js +16 -2
- package/dist/cjs/i18n/uk.js +18 -2
- package/dist/cjs/i18n/vi.js +13 -2
- package/dist/cjs/i18n/zh.js +18 -2
- package/dist/cjs/i18n/zh_TW.js +18 -2
- package/dist/cjs/messages.js +4 -4
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/cjs/plugins/analytics/types/enums.js +0 -1
- package/dist/cjs/plugins/analytics/types/node-events.js +1 -0
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/extension/actions.js +16 -16
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -2
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +19 -22
- package/dist/cjs/plugins/layout/actions.js +70 -16
- package/dist/cjs/plugins/layout/index.js +3 -2
- package/dist/cjs/plugins/layout/pm-plugins/main.js +3 -1
- package/dist/cjs/plugins/layout/toolbar-messages.js +5 -0
- package/dist/cjs/plugins/layout/toolbar.js +11 -2
- package/dist/cjs/plugins/list/pm-plugins/main.js +0 -38
- package/dist/cjs/plugins/macro/actions.js +14 -14
- package/dist/cjs/plugins/mentions/analytics.js +2 -3
- package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -12
- package/dist/cjs/plugins/panel/nodeviews/panel.js +7 -3
- package/dist/cjs/plugins/panel/toolbar.js +8 -6
- package/dist/cjs/plugins/panel/toolbar.test.js +25 -11
- package/dist/cjs/plugins/paste/handlers.js +2 -2
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/cjs/plugins/table/commands/insert.js +25 -10
- package/dist/cjs/plugins/table/commands/misc.js +3 -3
- package/dist/cjs/plugins/table/commands/selection.js +24 -24
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +20 -6
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +17 -16
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -0
- package/dist/cjs/plugins/table/toolbar.js +4 -4
- package/dist/cjs/plugins/table/transforms/column-width.js +72 -12
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/plugins/table/utils/table.js +17 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +5 -3
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -3
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
- package/dist/cjs/ui/ColorPickerButton/index.js +5 -2
- package/dist/cjs/ui/ColorPickerButton/index.test.js +16 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +2 -4
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +1 -3
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -3
- package/dist/cjs/ui/PanelTextInput/index.js +1 -3
- package/dist/cjs/utils/compare.js +7 -7
- package/dist/cjs/utils/index.js +7 -8
- package/dist/cjs/utils/rich-media-utils.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +2 -1
- package/dist/es2019/editor.js +1 -4
- package/dist/es2019/i18n/cs.js +18 -2
- package/dist/es2019/i18n/da.js +18 -2
- package/dist/es2019/i18n/de.js +18 -2
- package/dist/es2019/i18n/es.js +13 -2
- package/dist/es2019/i18n/et.js +0 -1
- package/dist/es2019/i18n/fi.js +13 -2
- package/dist/es2019/i18n/fr.js +13 -2
- package/dist/es2019/i18n/hu.js +14 -3
- package/dist/es2019/i18n/it.js +18 -2
- package/dist/es2019/i18n/ja.js +13 -2
- package/dist/es2019/i18n/ko.js +13 -2
- package/dist/es2019/i18n/nb.js +13 -2
- package/dist/es2019/i18n/nl.js +18 -2
- package/dist/es2019/i18n/pl.js +16 -2
- package/dist/es2019/i18n/pt_BR.js +14 -3
- package/dist/es2019/i18n/pt_PT.js +0 -1
- package/dist/es2019/i18n/ru.js +13 -2
- package/dist/es2019/i18n/sk.js +0 -1
- package/dist/es2019/i18n/sv.js +18 -2
- package/dist/es2019/i18n/th.js +18 -2
- package/dist/es2019/i18n/tr.js +16 -2
- package/dist/es2019/i18n/uk.js +18 -2
- package/dist/es2019/i18n/vi.js +13 -2
- package/dist/es2019/i18n/zh.js +18 -2
- package/dist/es2019/i18n/zh_TW.js +18 -2
- package/dist/es2019/messages.js +4 -4
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/es2019/plugins/analytics/types/enums.js +0 -1
- package/dist/es2019/plugins/analytics/types/node-events.js +1 -0
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/extension/actions.js +16 -16
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
- package/dist/es2019/plugins/layout/actions.js +64 -13
- package/dist/es2019/plugins/layout/index.js +3 -2
- package/dist/es2019/plugins/layout/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/layout/toolbar-messages.js +5 -0
- package/dist/es2019/plugins/layout/toolbar.js +10 -2
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -41
- package/dist/es2019/plugins/macro/actions.js +14 -14
- package/dist/es2019/plugins/mentions/analytics.js +2 -3
- package/dist/es2019/plugins/mentions/type-ahead/index.js +9 -15
- package/dist/es2019/plugins/panel/nodeviews/panel.js +5 -3
- package/dist/es2019/plugins/panel/toolbar.js +8 -6
- package/dist/es2019/plugins/panel/toolbar.test.js +18 -8
- package/dist/es2019/plugins/paste/handlers.js +2 -2
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/es2019/plugins/table/commands/insert.js +27 -12
- package/dist/es2019/plugins/table/commands/misc.js +3 -3
- package/dist/es2019/plugins/table/commands/selection.js +25 -25
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +19 -6
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -16
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +4 -4
- package/dist/es2019/plugins/table/transforms/column-width.js +62 -11
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/es2019/plugins/table/utils/table.js +7 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +5 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
- package/dist/es2019/ui/ColorPickerButton/index.js +6 -3
- package/dist/es2019/ui/ColorPickerButton/index.test.js +15 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +3 -4
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -3
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/es2019/ui/ConfigPanel/transformers.js +9 -9
- package/dist/es2019/ui/PanelTextInput/index.js +1 -3
- package/dist/es2019/utils/compare.js +7 -7
- package/dist/es2019/utils/index.js +7 -8
- package/dist/es2019/utils/rich-media-utils.js +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +2 -1
- package/dist/esm/editor.js +1 -4
- package/dist/esm/i18n/cs.js +18 -2
- package/dist/esm/i18n/da.js +18 -2
- package/dist/esm/i18n/de.js +18 -2
- package/dist/esm/i18n/es.js +13 -2
- package/dist/esm/i18n/et.js +0 -1
- package/dist/esm/i18n/fi.js +13 -2
- package/dist/esm/i18n/fr.js +13 -2
- package/dist/esm/i18n/hu.js +14 -3
- package/dist/esm/i18n/it.js +18 -2
- package/dist/esm/i18n/ja.js +13 -2
- package/dist/esm/i18n/ko.js +13 -2
- package/dist/esm/i18n/nb.js +13 -2
- package/dist/esm/i18n/nl.js +18 -2
- package/dist/esm/i18n/pl.js +16 -2
- package/dist/esm/i18n/pt_BR.js +14 -3
- package/dist/esm/i18n/pt_PT.js +0 -1
- package/dist/esm/i18n/ru.js +13 -2
- package/dist/esm/i18n/sk.js +0 -1
- package/dist/esm/i18n/sv.js +18 -2
- package/dist/esm/i18n/th.js +18 -2
- package/dist/esm/i18n/tr.js +16 -2
- package/dist/esm/i18n/uk.js +18 -2
- package/dist/esm/i18n/vi.js +13 -2
- package/dist/esm/i18n/zh.js +18 -2
- package/dist/esm/i18n/zh_TW.js +18 -2
- package/dist/esm/messages.js +4 -4
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/esm/plugins/analytics/types/enums.js +0 -1
- package/dist/esm/plugins/analytics/types/node-events.js +1 -0
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/extension/actions.js +16 -16
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +6 -3
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
- package/dist/esm/plugins/layout/actions.js +66 -13
- package/dist/esm/plugins/layout/index.js +3 -2
- package/dist/esm/plugins/layout/pm-plugins/main.js +3 -1
- package/dist/esm/plugins/layout/toolbar-messages.js +5 -0
- package/dist/esm/plugins/layout/toolbar.js +10 -2
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -37
- package/dist/esm/plugins/macro/actions.js +14 -14
- package/dist/esm/plugins/mentions/analytics.js +2 -3
- package/dist/esm/plugins/mentions/type-ahead/index.js +7 -12
- package/dist/esm/plugins/panel/nodeviews/panel.js +5 -3
- package/dist/esm/plugins/panel/toolbar.js +8 -6
- package/dist/esm/plugins/panel/toolbar.test.js +25 -11
- package/dist/esm/plugins/paste/handlers.js +2 -2
- package/dist/esm/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/esm/plugins/table/commands/insert.js +26 -11
- package/dist/esm/plugins/table/commands/misc.js +3 -3
- package/dist/esm/plugins/table/commands/selection.js +24 -24
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/esm/plugins/table/nodeviews/tableCell.js +21 -7
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +15 -17
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +4 -4
- package/dist/esm/plugins/table/transforms/column-width.js +62 -10
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/plugins/table/utils/table.js +9 -0
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +5 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
- package/dist/esm/ui/ColorPickerButton/index.js +6 -3
- package/dist/esm/ui/ColorPickerButton/index.test.js +15 -0
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +2 -3
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +1 -2
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/esm/ui/PanelTextInput/index.js +1 -3
- package/dist/esm/utils/compare.js +7 -7
- package/dist/esm/utils/index.js +7 -8
- package/dist/esm/utils/rich-media-utils.js +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/i18n/cs.d.ts +16 -0
- package/dist/types/i18n/da.d.ts +16 -0
- package/dist/types/i18n/de.d.ts +16 -0
- package/dist/types/i18n/es.d.ts +11 -0
- package/dist/types/i18n/et.d.ts +0 -1
- package/dist/types/i18n/fi.d.ts +11 -0
- package/dist/types/i18n/fr.d.ts +11 -0
- package/dist/types/i18n/hu.d.ts +11 -0
- package/dist/types/i18n/it.d.ts +16 -0
- package/dist/types/i18n/ja.d.ts +11 -0
- package/dist/types/i18n/ko.d.ts +11 -0
- package/dist/types/i18n/nb.d.ts +11 -0
- package/dist/types/i18n/nl.d.ts +16 -0
- package/dist/types/i18n/pl.d.ts +14 -0
- package/dist/types/i18n/pt_BR.d.ts +11 -0
- package/dist/types/i18n/pt_PT.d.ts +0 -1
- package/dist/types/i18n/ru.d.ts +11 -0
- package/dist/types/i18n/sk.d.ts +0 -1
- package/dist/types/i18n/sv.d.ts +16 -0
- package/dist/types/i18n/th.d.ts +16 -0
- package/dist/types/i18n/tr.d.ts +14 -0
- package/dist/types/i18n/uk.d.ts +16 -0
- package/dist/types/i18n/vi.d.ts +11 -0
- package/dist/types/i18n/zh.d.ts +16 -0
- package/dist/types/i18n/zh_TW.d.ts +16 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +0 -1
- package/dist/types/plugins/analytics/types/general-events.d.ts +1 -1
- package/dist/types/plugins/analytics/types/list-events.d.ts +1 -5
- package/dist/types/plugins/analytics/types/node-events.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +1 -0
- package/dist/types/plugins/layout/actions.d.ts +1 -0
- package/dist/types/plugins/layout/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/layout/toolbar-messages.d.ts +5 -0
- package/dist/types/plugins/layout/toolbar.d.ts +1 -1
- package/dist/types/plugins/layout/types.d.ts +2 -1
- package/dist/types/plugins/mentions/analytics.d.ts +1 -1
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -0
- package/dist/types/plugins/table/transforms/column-width.d.ts +10 -0
- package/dist/types/plugins/table/utils/table.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +1 -1
- package/package.json +22 -22
- package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +0 -1
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.forceSectionToPresetLayout = forceSectionToPresetLayout;
|
|
9
|
-
exports.deleteActiveLayoutNode = exports.fixColumnStructure = exports.fixColumnSizes = exports.setPresetLayout = exports.insertLayoutColumnsWithAnalytics = exports.insertLayoutColumns = exports.createDefaultLayoutSection = exports.getSelectedLayout = exports.getPresetLayout = exports.THREE_COL_LAYOUTS = exports.TWO_COL_LAYOUTS = void 0;
|
|
9
|
+
exports.deleteActiveLayoutNode = exports.fixColumnStructure = exports.fixColumnSizes = exports.setPresetLayout = exports.insertLayoutColumnsWithAnalytics = exports.insertLayoutColumns = exports.createDefaultLayoutSection = exports.getSelectedLayout = exports.getPresetLayout = exports.THREE_COL_LAYOUTS = exports.TWO_COL_LAYOUTS = exports.ONE_COL_LAYOUTS = void 0;
|
|
10
10
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
|
|
@@ -32,6 +32,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
32
32
|
|
|
33
33
|
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; }
|
|
34
34
|
|
|
35
|
+
var ONE_COL_LAYOUTS = ['single'];
|
|
36
|
+
exports.ONE_COL_LAYOUTS = ONE_COL_LAYOUTS;
|
|
35
37
|
var TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
36
38
|
exports.TWO_COL_LAYOUTS = TWO_COL_LAYOUTS;
|
|
37
39
|
var THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
|
|
@@ -39,6 +41,9 @@ exports.THREE_COL_LAYOUTS = THREE_COL_LAYOUTS;
|
|
|
39
41
|
|
|
40
42
|
var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
|
|
41
43
|
switch (presetLayout) {
|
|
44
|
+
case 'single':
|
|
45
|
+
return [100];
|
|
46
|
+
|
|
42
47
|
case 'two_equal':
|
|
43
48
|
return [50, 50];
|
|
44
49
|
|
|
@@ -67,6 +72,9 @@ var getPresetLayout = function getPresetLayout(section) {
|
|
|
67
72
|
}).join(',');
|
|
68
73
|
|
|
69
74
|
switch (widths) {
|
|
75
|
+
case '100':
|
|
76
|
+
return 'single';
|
|
77
|
+
|
|
70
78
|
case '33.33,33.33,33.33':
|
|
71
79
|
return 'three_equal';
|
|
72
80
|
|
|
@@ -135,6 +143,47 @@ var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAnalytics
|
|
|
135
143
|
eventType: _enums.EVENT_TYPE.TRACK
|
|
136
144
|
})(insertLayoutColumns);
|
|
137
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Add a column to the right of existing layout
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
exports.insertLayoutColumnsWithAnalytics = insertLayoutColumnsWithAnalytics;
|
|
152
|
+
|
|
153
|
+
function addColumn(schema, pos) {
|
|
154
|
+
return function (tr) {
|
|
155
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
|
|
160
|
+
return function (tr) {
|
|
161
|
+
if ((0, _utils.isEmptyDocument)(column)) {
|
|
162
|
+
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), _prosemirrorModel.Slice.empty);
|
|
163
|
+
} else {
|
|
164
|
+
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), _prosemirrorModel.Slice.empty);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var fromTwoColsToThree = addColumn;
|
|
170
|
+
var fromOneColToTwo = addColumn;
|
|
171
|
+
var fromTwoColsToOne = removeLastColumnInLayout;
|
|
172
|
+
var fromThreeColsToTwo = removeLastColumnInLayout;
|
|
173
|
+
|
|
174
|
+
var fromOneColToThree = function fromOneColToThree(schema, pos) {
|
|
175
|
+
return function (tr) {
|
|
176
|
+
addColumn(schema, pos)(tr);
|
|
177
|
+
addColumn(schema, pos)(tr);
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var fromThreeColstoOne = function fromThreeColstoOne(node, tr, insideRightEdgePos) {
|
|
182
|
+
var thirdColumn = node.content.child(2);
|
|
183
|
+
fromThreeColsToTwo(thirdColumn, insideRightEdgePos - thirdColumn.nodeSize, insideRightEdgePos)(tr);
|
|
184
|
+
var secondColumn = node.content.child(1);
|
|
185
|
+
fromTwoColsToOne(secondColumn, insideRightEdgePos - thirdColumn.nodeSize - secondColumn.nodeSize, insideRightEdgePos)(tr);
|
|
186
|
+
};
|
|
138
187
|
/**
|
|
139
188
|
* Handles switching from 2 -> 3 cols, or 3 -> 2 cols
|
|
140
189
|
* Switching from 2 -> 3 just adds a new one at the end
|
|
@@ -143,27 +192,29 @@ var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAnalytics
|
|
|
143
192
|
*/
|
|
144
193
|
|
|
145
194
|
|
|
146
|
-
exports.insertLayoutColumnsWithAnalytics = insertLayoutColumnsWithAnalytics;
|
|
147
|
-
|
|
148
195
|
function forceColumnStructure(state, node, pos, presetLayout) {
|
|
149
196
|
var tr = state.tr;
|
|
150
197
|
var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
|
|
151
|
-
var numCols = node.childCount;
|
|
198
|
+
var numCols = node.childCount; // 3 columns -> 2 columns
|
|
152
199
|
|
|
153
200
|
if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
|
|
154
201
|
var thirdColumn = node.content.child(2);
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
if ((0, _utils.isEmptyDocument)(thirdColumn)) {
|
|
158
|
-
tr.replaceRange( // end pos of second column
|
|
159
|
-
tr.mapping.map(thirdColumnPos - 1), tr.mapping.map(insideRightEdgeOfLayoutSection), _prosemirrorModel.Slice.empty);
|
|
160
|
-
} else {
|
|
161
|
-
tr.replaceRange( // end pos of second column
|
|
162
|
-
tr.mapping.map(thirdColumnPos - 1), // start pos of third column
|
|
163
|
-
tr.mapping.map(thirdColumnPos + 1), _prosemirrorModel.Slice.empty);
|
|
164
|
-
}
|
|
202
|
+
var columnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
|
|
203
|
+
fromThreeColsToTwo(thirdColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 3 columns
|
|
165
204
|
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
166
|
-
|
|
205
|
+
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 1 column
|
|
206
|
+
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
207
|
+
var secondColumn = node.content.child(1);
|
|
208
|
+
|
|
209
|
+
var _columnPos = insideRightEdgeOfLayoutSection - secondColumn.nodeSize;
|
|
210
|
+
|
|
211
|
+
fromTwoColsToOne(secondColumn, _columnPos, insideRightEdgeOfLayoutSection)(tr); // 3 columns -> 1 column
|
|
212
|
+
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
|
|
213
|
+
fromThreeColstoOne(node, tr, insideRightEdgeOfLayoutSection); // 1 column -> 2 columns
|
|
214
|
+
} else if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
|
|
215
|
+
fromOneColToTwo(state.schema, insideRightEdgeOfLayoutSection)(tr); // 1 column -> 3 columns
|
|
216
|
+
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
|
|
217
|
+
fromOneColToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
|
|
167
218
|
}
|
|
168
219
|
|
|
169
220
|
return tr;
|
|
@@ -259,7 +310,7 @@ function getLayoutChange(node, pos, schema) {
|
|
|
259
310
|
return;
|
|
260
311
|
}
|
|
261
312
|
|
|
262
|
-
var presetLayout = node.childCount === 2 ? 'two_equal' : 'three_equal';
|
|
313
|
+
var presetLayout = node.childCount === 2 ? 'two_equal' : node.childCount === 3 ? 'three_equal' : 'single';
|
|
263
314
|
var fixedColumns = columnWidth(node, schema, getWidthsForPreset(presetLayout));
|
|
264
315
|
return {
|
|
265
316
|
from: pos + 1,
|
|
@@ -360,6 +411,9 @@ exports.deleteActiveLayoutNode = deleteActiveLayoutNode;
|
|
|
360
411
|
|
|
361
412
|
var formatLayoutName = function formatLayoutName(layout) {
|
|
362
413
|
switch (layout) {
|
|
414
|
+
case 'single':
|
|
415
|
+
return _nodeEvents.LAYOUT_TYPE.SINGLE_COL;
|
|
416
|
+
|
|
363
417
|
case 'two_equal':
|
|
364
418
|
return _nodeEvents.LAYOUT_TYPE.TWO_COLS_EQUAL;
|
|
365
419
|
|
|
@@ -57,10 +57,11 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
57
57
|
var _ref = _pluginKey.pluginKey.getState(state),
|
|
58
58
|
pos = _ref.pos,
|
|
59
59
|
allowBreakout = _ref.allowBreakout,
|
|
60
|
-
addSidebarLayouts = _ref.addSidebarLayouts
|
|
60
|
+
addSidebarLayouts = _ref.addSidebarLayouts,
|
|
61
|
+
allowSingleColumnLayout = _ref.allowSingleColumnLayout;
|
|
61
62
|
|
|
62
63
|
if (pos !== null) {
|
|
63
|
-
return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts);
|
|
64
|
+
return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
return undefined;
|
|
@@ -76,13 +76,15 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
|
|
|
76
76
|
var maybeLayoutSection = (0, _prosemirrorUtils.findParentNodeOfType)(state.schema.nodes.layoutSection)(state.selection);
|
|
77
77
|
var allowBreakout = options.allowBreakout || false;
|
|
78
78
|
var addSidebarLayouts = options.UNSAFE_addSidebarLayouts || false;
|
|
79
|
+
var allowSingleColumnLayout = options.UNSAFE_allowSingleColumnLayout || false;
|
|
79
80
|
var pos = maybeLayoutSection ? maybeLayoutSection.pos : null;
|
|
80
81
|
var selectedLayout = (0, _actions.getSelectedLayout)(maybeLayoutSection && maybeLayoutSection.node, DEFAULT_LAYOUT);
|
|
81
82
|
return {
|
|
82
83
|
pos: pos,
|
|
83
84
|
allowBreakout: allowBreakout,
|
|
84
85
|
addSidebarLayouts: addSidebarLayouts,
|
|
85
|
-
selectedLayout: selectedLayout
|
|
86
|
+
selectedLayout: selectedLayout,
|
|
87
|
+
allowSingleColumnLayout: allowSingleColumnLayout
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
90
|
|
|
@@ -8,6 +8,11 @@ exports.toolbarMessages = void 0;
|
|
|
8
8
|
var _reactIntl = require("react-intl");
|
|
9
9
|
|
|
10
10
|
var toolbarMessages = (0, _reactIntl.defineMessages)({
|
|
11
|
+
singleColumn: {
|
|
12
|
+
id: 'fabric.editor.single',
|
|
13
|
+
defaultMessage: 'Single column',
|
|
14
|
+
description: 'Layout with one single column'
|
|
15
|
+
},
|
|
11
16
|
twoColumns: {
|
|
12
17
|
id: 'fabric.editor.twoColumns',
|
|
13
18
|
defaultMessage: 'Two columns',
|
|
@@ -11,6 +11,8 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
11
11
|
|
|
12
12
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
13
13
|
|
|
14
|
+
var _layoutSingle = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-single"));
|
|
15
|
+
|
|
14
16
|
var _layoutTwoEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-two-equal"));
|
|
15
17
|
|
|
16
18
|
var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
|
|
@@ -42,6 +44,12 @@ var LAYOUT_TYPES = [{
|
|
|
42
44
|
title: _toolbarMessages.toolbarMessages.threeColumns,
|
|
43
45
|
icon: _layoutThreeEqual.default
|
|
44
46
|
}];
|
|
47
|
+
var LAYOUT_TYPES_WITH_SINGLE_COL = [{
|
|
48
|
+
id: 'editor.layout.singeLayout',
|
|
49
|
+
type: 'single',
|
|
50
|
+
title: _toolbarMessages.toolbarMessages.singleColumn,
|
|
51
|
+
icon: _layoutSingle.default
|
|
52
|
+
}].concat(LAYOUT_TYPES);
|
|
45
53
|
var SIDEBAR_LAYOUT_TYPES = [{
|
|
46
54
|
id: 'editor.layout.twoRightSidebar',
|
|
47
55
|
type: 'two_right_sidebar',
|
|
@@ -74,7 +82,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout) {
|
|
|
74
82
|
var layoutToolbarTitle = 'Layout floating controls';
|
|
75
83
|
exports.layoutToolbarTitle = layoutToolbarTitle;
|
|
76
84
|
|
|
77
|
-
var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts) {
|
|
85
|
+
var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) {
|
|
78
86
|
var node = state.doc.nodeAt(pos);
|
|
79
87
|
|
|
80
88
|
if (node) {
|
|
@@ -96,13 +104,14 @@ var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSi
|
|
|
96
104
|
onFocus: (0, _decoration.hoverDecoration)(nodeType, true),
|
|
97
105
|
onBlur: (0, _decoration.hoverDecoration)(nodeType, false)
|
|
98
106
|
};
|
|
107
|
+
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
99
108
|
return {
|
|
100
109
|
title: layoutToolbarTitle,
|
|
101
110
|
getDomRef: function getDomRef(view) {
|
|
102
111
|
return (0, _prosemirrorUtils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
|
|
103
112
|
},
|
|
104
113
|
nodeType: nodeType,
|
|
105
|
-
items: [].concat((0, _toConsumableArray2.default)(
|
|
114
|
+
items: [].concat((0, _toConsumableArray2.default)(layoutTypes.map(function (i) {
|
|
106
115
|
return buildLayoutButton(intl, i, currentLayout);
|
|
107
116
|
})), (0, _toConsumableArray2.default)(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
|
|
108
117
|
return buildLayoutButton(intl, i, currentLayout);
|
|
@@ -15,16 +15,12 @@ var _prosemirrorView = require("prosemirror-view");
|
|
|
15
15
|
|
|
16
16
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
17
17
|
|
|
18
|
-
var _analytics = require("../../analytics");
|
|
19
|
-
|
|
20
18
|
var _selection = require("../utils/selection");
|
|
21
19
|
|
|
22
20
|
var _node = require("../utils/node");
|
|
23
21
|
|
|
24
22
|
var _pluginStateFactory = require("../../../utils/plugin-state-factory");
|
|
25
23
|
|
|
26
|
-
var _find = require("../utils/find");
|
|
27
|
-
|
|
28
24
|
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; }
|
|
29
25
|
|
|
30
26
|
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; }
|
|
@@ -133,40 +129,6 @@ var createPlugin = function createPlugin(eventDispatch) {
|
|
|
133
129
|
return new _prosemirrorState.Plugin({
|
|
134
130
|
state: createPluginState(eventDispatch, createInitialState),
|
|
135
131
|
key: listPluginKey,
|
|
136
|
-
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
137
|
-
var lastTransaction = transactions[transactions.length - 1];
|
|
138
|
-
|
|
139
|
-
if (!lastTransaction.docChanged || !lastTransaction.selectionSet) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
var tr = newState.tr;
|
|
144
|
-
var rootList = (0, _find.findRootParentListNode)(tr.selection.$from);
|
|
145
|
-
|
|
146
|
-
if (!rootList) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var listsJoined = (0, _node.joinSiblingLists)({
|
|
151
|
-
tr: tr,
|
|
152
|
-
direction: _node.JoinDirection.RIGHT
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (tr.docChanged) {
|
|
156
|
-
var orderedListsJoined = listsJoined.orderedList,
|
|
157
|
-
bulletListsJoined = listsJoined.bulletList;
|
|
158
|
-
(0, _analytics.addAnalytics)(newState, tr, {
|
|
159
|
-
action: _analytics.ACTION.FIXED,
|
|
160
|
-
actionSubject: _analytics.ACTION_SUBJECT.LIST,
|
|
161
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
162
|
-
attributes: {
|
|
163
|
-
orderedListsJoined: orderedListsJoined,
|
|
164
|
-
bulletListsJoined: bulletListsJoined
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
return tr;
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
132
|
props: {
|
|
171
133
|
decorations: function decorations(state) {
|
|
172
134
|
var _getPluginState = getPluginState(state),
|
|
@@ -91,20 +91,20 @@ var insertMacroFromMacroBrowser = function insertMacroFromMacroBrowser(macroProv
|
|
|
91
91
|
tr.setSelection(_prosemirrorState.TextSelection.create(tr.doc, state.selection.anchor));
|
|
92
92
|
} // If any extension is currently selected
|
|
93
93
|
else if ((0, _prosemirrorUtils.findSelectedNodeOfType)([extension, bodiedExtension, inlineExtension])(selection)) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
94
|
+
tr = (0, _prosemirrorUtils.replaceSelectedNode)(node)(tr); // Replacing selected node doesn't update the selection. `selection.node` still returns the old node
|
|
95
|
+
|
|
96
|
+
tr.setSelection(_prosemirrorState.NodeSelection.create(tr.doc, tr.mapping.map(state.selection.anchor)));
|
|
97
|
+
} // When we loose the selection. This usually happens when Synchrony resets or changes
|
|
98
|
+
// the selection when user is in the middle of updating an extension.
|
|
99
|
+
else if (extensionState.element) {
|
|
100
|
+
pos = view.posAtDOM(extensionState.element, -1);
|
|
101
|
+
|
|
102
|
+
if (pos > -1) {
|
|
103
|
+
tr = tr.replaceWith(pos, pos + macroNode.nodeSize, node);
|
|
104
|
+
tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(pos)));
|
|
105
|
+
targetSelectionSource = _extensionEvents.TARGET_SELECTION_SOURCE.HTML_ELEMENT;
|
|
106
|
+
}
|
|
107
|
+
} // Only scroll if we have anything to update, best to avoid surprise scroll
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
if (dispatch && tr.docChanged) {
|
|
@@ -102,7 +102,7 @@ var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemVie
|
|
|
102
102
|
|
|
103
103
|
exports.buildTypeAheadInviteItemViewedPayload = buildTypeAheadInviteItemViewedPayload;
|
|
104
104
|
|
|
105
|
-
var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(
|
|
105
|
+
var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) {
|
|
106
106
|
var _ref2 = contextIdentifierProvider || {},
|
|
107
107
|
containerId = _ref2.containerId,
|
|
108
108
|
objectId = _ref2.objectId,
|
|
@@ -110,8 +110,7 @@ var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposureP
|
|
|
110
110
|
|
|
111
111
|
return buildAnalyticsPayload('feature', 'exposed', _analyticsGasTypes.OPERATIONAL_EVENT_TYPE, sessionId, {
|
|
112
112
|
flagKey: 'confluence.frontend.invite.from.mention',
|
|
113
|
-
value:
|
|
114
|
-
cohort: inviteExperimentCohort,
|
|
113
|
+
value: inviteExperimentCohort || 'not-enrolled',
|
|
115
114
|
containerId: containerId,
|
|
116
115
|
objectId: objectId,
|
|
117
116
|
childObjectId: childObjectId,
|
|
@@ -292,6 +292,13 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
292
292
|
|
|
293
293
|
if (mentions.length === 0 && firstQueryWithoutResults === null) {
|
|
294
294
|
firstQueryWithoutResults = query;
|
|
295
|
+
} // Growth (El-dorado) experiment design hard requirement
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
if (mentionItems.length <= 2) {
|
|
299
|
+
var inviteExperimentCohort = mentionProvider.inviteExperimentCohort,
|
|
300
|
+
userRole = mentionProvider.userRole;
|
|
301
|
+
fireEvent((0, _analytics.buildTypeAheadInviteExposurePayload)(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
295
302
|
}
|
|
296
303
|
|
|
297
304
|
if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
|
|
@@ -317,18 +324,6 @@ var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
317
324
|
},
|
|
318
325
|
onOpen: function onOpen(editorState) {
|
|
319
326
|
firstQueryWithoutResults = null;
|
|
320
|
-
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
321
|
-
|
|
322
|
-
if (!pluginState || !pluginState.mentionProvider) {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
var contextIdentifierProvider = pluginState.contextIdentifierProvider,
|
|
327
|
-
_pluginState$mentionP = pluginState.mentionProvider,
|
|
328
|
-
shouldEnableInvite = _pluginState$mentionP.shouldEnableInvite,
|
|
329
|
-
inviteExperimentCohort = _pluginState$mentionP.inviteExperimentCohort,
|
|
330
|
-
userRole = _pluginState$mentionP.userRole;
|
|
331
|
-
fireEvent((0, _analytics.buildTypeAheadInviteExposurePayload)(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
332
327
|
},
|
|
333
328
|
selectItem: function selectItem(state, item, insert, _ref8) {
|
|
334
329
|
var mode = _ref8.mode,
|
|
@@ -35,7 +35,8 @@ var _editorCommon = require("@atlaskit/editor-common");
|
|
|
35
35
|
|
|
36
36
|
var _utils = require("../utils");
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _consts = require("@atlaskit/editor-shared-styles/consts");
|
|
39
|
+
|
|
39
40
|
var panelIcons = {
|
|
40
41
|
info: _info.default,
|
|
41
42
|
success: _success.default,
|
|
@@ -60,7 +61,7 @@ var PanelIcon = function PanelIcon(props) {
|
|
|
60
61
|
shortName: panelIcon,
|
|
61
62
|
showTooltip: false,
|
|
62
63
|
allowTextFallback: false,
|
|
63
|
-
fitToHeight:
|
|
64
|
+
fitToHeight: _consts.akEditorCustomIconSize
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -91,7 +92,10 @@ var PanelNodeView = /*#__PURE__*/function () {
|
|
|
91
92
|
|
|
92
93
|
if (!this.icon) {
|
|
93
94
|
return;
|
|
94
|
-
}
|
|
95
|
+
} // set contentEditable as false to be able to select the custom panels with keyboard
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
this.icon.contentEditable = 'false';
|
|
95
99
|
|
|
96
100
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(PanelIcon, {
|
|
97
101
|
allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
|
|
@@ -21,7 +21,7 @@ var _warning = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/warni
|
|
|
21
21
|
|
|
22
22
|
var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/error"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _EditorRemoveEmojiIcon = _interopRequireDefault(require("../floating-toolbar/ui/EditorRemoveEmojiIcon"));
|
|
25
25
|
|
|
26
26
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
27
27
|
|
|
@@ -247,13 +247,15 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
247
247
|
return changeEmoji(emojiShortName);
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
|
-
|
|
251
|
-
id: 'editor.panel.
|
|
250
|
+
var removeEmojiButton = {
|
|
251
|
+
id: 'editor.panel.removeEmoji',
|
|
252
252
|
type: 'button',
|
|
253
|
-
icon:
|
|
253
|
+
icon: _EditorRemoveEmojiIcon.default,
|
|
254
254
|
onClick: removeEmoji(),
|
|
255
|
-
title: formatMessage(_messages.default.
|
|
256
|
-
|
|
255
|
+
title: formatMessage(_messages.default.removeEmoji),
|
|
256
|
+
disabled: activePanelIcon ? false : true
|
|
257
|
+
};
|
|
258
|
+
items.push(emojiPicker, removeEmojiButton, {
|
|
257
259
|
type: 'separator'
|
|
258
260
|
}, colorPicker);
|
|
259
261
|
}
|
|
@@ -100,16 +100,16 @@ describe('getToolbarItems', function () {
|
|
|
100
100
|
color: '#ABF5D1'
|
|
101
101
|
}, true);
|
|
102
102
|
});
|
|
103
|
-
it("should call changePanelType when clicked on
|
|
104
|
-
var
|
|
105
|
-
return item.type === 'button' && item.id === 'editor.panel.
|
|
103
|
+
it("should call changePanelType when clicked on remove emoji", function () {
|
|
104
|
+
var removeEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
105
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
106
106
|
});
|
|
107
|
-
|
|
107
|
+
removeEmojiButton.onClick(editorView.state);
|
|
108
108
|
expect(changePanelTypespy).toBeCalledWith(_adfSchema.PanelType.CUSTOM, {
|
|
109
109
|
emoji: undefined
|
|
110
110
|
}, true);
|
|
111
111
|
});
|
|
112
|
-
it("should not call changePanelType when clicked on
|
|
112
|
+
it("should not call changePanelType when clicked on remove emoji when no emoji in panel", function () {
|
|
113
113
|
var _createEditor2 = createEditor({
|
|
114
114
|
doc: (0, _docBuilder.doc)((0, _docBuilder.panel)({
|
|
115
115
|
panelType: 'custom'
|
|
@@ -120,13 +120,27 @@ describe('getToolbarItems', function () {
|
|
|
120
120
|
editorView = _createEditor2.editorView;
|
|
121
121
|
|
|
122
122
|
var toolbarItems = (0, _toolbar.getToolbarItems)(dummyFormatMessage, _schema.default.nodes.panel, true, providerFactory, _adfSchema.PanelType.CUSTOM);
|
|
123
|
-
var
|
|
124
|
-
return item.type === 'button' && item.id === 'editor.panel.
|
|
123
|
+
var removeEmojiButton = toolbarItems.find(function (item) {
|
|
124
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
125
125
|
});
|
|
126
126
|
changePanelTypespy.mockClear();
|
|
127
|
-
|
|
127
|
+
removeEmojiButton.onClick(editorView.state);
|
|
128
128
|
expect(changePanelTypespy).not.toBeCalled();
|
|
129
129
|
});
|
|
130
|
+
it("should have remove emoji button disabled when focus on panel without emoji", function () {
|
|
131
|
+
var toolbarItems = (0, _toolbar.getToolbarItems)(dummyFormatMessage, _schema.default.nodes.panel, true, providerFactory, _adfSchema.PanelType.CUSTOM, '#ABF5D1', '');
|
|
132
|
+
var removeEmojiButton = toolbarItems.find(function (item) {
|
|
133
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
134
|
+
});
|
|
135
|
+
expect(removeEmojiButton.disabled).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it("should have remove emoji button enabled when focus on panel with emoji", function () {
|
|
138
|
+
var toolbarItems = (0, _toolbar.getToolbarItems)(dummyFormatMessage, _schema.default.nodes.panel, true, providerFactory, _adfSchema.PanelType.CUSTOM, '#ABF5D1', ':smiley:');
|
|
139
|
+
var removeEmojiButton = toolbarItems.find(function (item) {
|
|
140
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
141
|
+
});
|
|
142
|
+
expect(removeEmojiButton.disabled).toBe(false);
|
|
143
|
+
});
|
|
130
144
|
});
|
|
131
145
|
describe('analytics for custom panels', function () {
|
|
132
146
|
var createEditor = (0, _createProsemirrorEditor.createProsemirrorEditorFactory)();
|
|
@@ -189,14 +203,14 @@ describe('getToolbarItems', function () {
|
|
|
189
203
|
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
190
204
|
});
|
|
191
205
|
it('Should trigger analytics when Icon is removed', function () {
|
|
192
|
-
var
|
|
193
|
-
return item.type === 'button' && item.id === 'editor.panel.
|
|
206
|
+
var removeEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
207
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
194
208
|
});
|
|
195
209
|
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
196
210
|
return item.type === 'select' && item.selectType === 'emoji';
|
|
197
211
|
});
|
|
198
212
|
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
199
|
-
|
|
213
|
+
removeEmojiButton.onClick(editorView.state, editorView.dispatch);
|
|
200
214
|
var payload = {
|
|
201
215
|
action: _analytics.ACTION.REMOVE_ICON,
|
|
202
216
|
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
@@ -117,8 +117,8 @@ function handlePasteIntoTaskAndDecision(slice) {
|
|
|
117
117
|
|
|
118
118
|
if (selection instanceof _prosemirrorState.TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && (0, _util.hasOnlyNodesOfType)(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState.codeActive) // for codeMarks let's make sure mark is active
|
|
119
119
|
) {
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
filters.push((0, _util.applyTextMarksToSlice)(schema, selection.$head.marks()));
|
|
121
|
+
}
|
|
122
122
|
|
|
123
123
|
var transformedSlice = _utils.compose.apply(null, filters)(slice);
|
|
124
124
|
|
|
@@ -116,8 +116,7 @@ var arrow = function arrow(dir, endOfTextblock) {
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
if (selection instanceof _selection.GapCursorSelection && // next node allow gap cursor position
|
|
119
|
-
(0, _isValidTargetNode.isValidTargetNode)((0, _direction.isBackward)(dir) ? $pos.nodeBefore : $pos.nodeAfter) && (
|
|
120
|
-
(0, _direction.isBackward)(dir) && selection.side === _selection.Side.LEFT || (0, _direction.isForward)(dir) && selection.side === _selection.Side.RIGHT)) {
|
|
119
|
+
(0, _isValidTargetNode.isValidTargetNode)((0, _direction.isBackward)(dir) ? $pos.nodeBefore : $pos.nodeAfter) && ((0, _direction.isBackward)(dir) && selection.side === _selection.Side.LEFT || (0, _direction.isForward)(dir) && selection.side === _selection.Side.RIGHT)) {
|
|
121
120
|
// reverse cursor position
|
|
122
121
|
if (dispatch) {
|
|
123
122
|
dispatch(tr.setSelection(new _selection.GapCursorSelection($pos, selection.side === _selection.Side.RIGHT ? _selection.Side.LEFT : _selection.Side.RIGHT)).scrollIntoView());
|
|
@@ -291,12 +290,12 @@ var setSelectionTopLevelBlocks = function setSelectionTopLevelBlocks(tr, event,
|
|
|
291
290
|
} // try to set text selection if the editor isnt focused
|
|
292
291
|
// if the editor is focused, we are most likely dragging a selection outside.
|
|
293
292
|
else if (editorFocused === false) {
|
|
294
|
-
|
|
293
|
+
var selectionTemp = _prosemirrorState.Selection.findFrom($pos, cursorCoords.side === _selection.Side.LEFT ? 1 : -1, true);
|
|
295
294
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
295
|
+
if (selectionTemp) {
|
|
296
|
+
tr.setSelection(selectionTemp);
|
|
299
297
|
}
|
|
298
|
+
}
|
|
300
299
|
};
|
|
301
300
|
|
|
302
301
|
exports.setSelectionTopLevelBlocks = setSelectionTopLevelBlocks;
|
|
@@ -43,9 +43,7 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent) {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
var analyticsPayload = (0, _utils.getNodeSelectionAnalyticsPayload)(state.selection) || (0, _utils.getAllSelectionAnalyticsPayload)(state.selection) || // We
|
|
47
|
-
// handled in mouseup handler below
|
|
48
|
-
!editorView.mouseDown && ((0, _utils.getRangeSelectionAnalyticsPayload)(state.selection, state.doc) || (0, _utils.getCellSelectionAnalyticsPayload)(state)); // We have to use dispatchAnalyticsEvent over any of the analytics plugin helpers
|
|
46
|
+
var analyticsPayload = (0, _utils.getNodeSelectionAnalyticsPayload)(state.selection) || (0, _utils.getAllSelectionAnalyticsPayload)(state.selection) || !editorView.mouseDown && ((0, _utils.getRangeSelectionAnalyticsPayload)(state.selection, state.doc) || (0, _utils.getCellSelectionAnalyticsPayload)(state)); // We have to use dispatchAnalyticsEvent over any of the analytics plugin helpers
|
|
49
47
|
// as there were several issues caused by the fact that adding analytics through
|
|
50
48
|
// the plugin adds a new step to the transaction
|
|
51
49
|
// This causes prosemirror to run through some different code paths, eg. attempting
|