@atlaskit/editor-core 185.2.23 → 185.2.25

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/editor-next/hooks/useProviderFactory.js +54 -5
  3. package/dist/cjs/labs/next/presets/universal.js +6 -5
  4. package/dist/cjs/plugins/extension/actions.js +6 -4
  5. package/dist/cjs/plugins/extension/commands.js +19 -16
  6. package/dist/cjs/plugins/extension/context-panel.js +4 -4
  7. package/dist/cjs/plugins/extension/extension-api.js +1 -1
  8. package/dist/cjs/plugins/extension/index.js +11 -4
  9. package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
  10. package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
  11. package/dist/cjs/plugins/extension/toolbar.js +8 -6
  12. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  13. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  14. package/dist/cjs/plugins/index.js +0 -7
  15. package/dist/cjs/ui/ContextPanel/index.js +9 -2
  16. package/dist/cjs/utils/action.js +1 -1
  17. package/dist/cjs/version-wrapper.js +1 -1
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/editor-next/hooks/useProviderFactory.js +54 -5
  20. package/dist/es2019/labs/next/presets/universal.js +7 -6
  21. package/dist/es2019/plugins/extension/actions.js +6 -4
  22. package/dist/es2019/plugins/extension/commands.js +6 -7
  23. package/dist/es2019/plugins/extension/context-panel.js +4 -4
  24. package/dist/es2019/plugins/extension/extension-api.js +1 -1
  25. package/dist/es2019/plugins/extension/index.js +11 -4
  26. package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
  27. package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
  28. package/dist/es2019/plugins/extension/toolbar.js +8 -4
  29. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  30. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  31. package/dist/es2019/plugins/index.js +0 -1
  32. package/dist/es2019/ui/ContextPanel/index.js +8 -1
  33. package/dist/es2019/utils/action.js +1 -1
  34. package/dist/es2019/version-wrapper.js +1 -1
  35. package/dist/es2019/version.json +1 -1
  36. package/dist/esm/editor-next/hooks/useProviderFactory.js +54 -5
  37. package/dist/esm/labs/next/presets/universal.js +7 -6
  38. package/dist/esm/plugins/extension/actions.js +6 -4
  39. package/dist/esm/plugins/extension/commands.js +18 -15
  40. package/dist/esm/plugins/extension/context-panel.js +4 -4
  41. package/dist/esm/plugins/extension/extension-api.js +1 -1
  42. package/dist/esm/plugins/extension/index.js +11 -4
  43. package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
  44. package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
  45. package/dist/esm/plugins/extension/toolbar.js +8 -6
  46. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  47. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  48. package/dist/esm/plugins/index.js +0 -1
  49. package/dist/esm/ui/ContextPanel/index.js +8 -1
  50. package/dist/esm/utils/action.js +1 -1
  51. package/dist/esm/version-wrapper.js +1 -1
  52. package/dist/esm/version.json +1 -1
  53. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +0 -1
  54. package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
  55. package/dist/types/labs/next/presets/default.d.ts +36 -4
  56. package/dist/types/labs/next/presets/mobile.d.ts +18 -2
  57. package/dist/types/plugins/extension/actions.d.ts +2 -1
  58. package/dist/types/plugins/extension/commands.d.ts +4 -3
  59. package/dist/types/plugins/extension/context-panel.d.ts +2 -1
  60. package/dist/types/plugins/extension/extension-api.d.ts +2 -0
  61. package/dist/types/plugins/extension/index.d.ts +4 -2
  62. package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  63. package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
  64. package/dist/types/plugins/extension/toolbar.d.ts +8 -1
  65. package/dist/types/plugins/extension/types.d.ts +2 -0
  66. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  67. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  68. package/dist/types/plugins/index.d.ts +0 -1
  69. package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +0 -1
  70. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
  71. package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
  72. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
  73. package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
  74. package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
  75. package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
  76. package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
  77. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  78. package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  79. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
  80. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
  81. package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
  82. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  83. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  84. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  85. package/package.json +4 -3
  86. package/dist/cjs/plugins/context-panel/index.js +0 -66
  87. package/dist/cjs/plugins/context-panel/transforms.js +0 -13
  88. package/dist/cjs/plugins/context-panel/types.js +0 -5
  89. package/dist/es2019/plugins/context-panel/index.js +0 -45
  90. package/dist/es2019/plugins/context-panel/transforms.js +0 -4
  91. package/dist/es2019/plugins/context-panel/types.js +0 -1
  92. package/dist/esm/plugins/context-panel/index.js +0 -57
  93. package/dist/esm/plugins/context-panel/transforms.js +0 -6
  94. package/dist/esm/plugins/context-panel/types.js +0 -1
  95. package/dist/types/plugins/context-panel/index.d.ts +0 -11
  96. package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
  97. package/dist/types/plugins/context-panel/types.d.ts +0 -1
  98. package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
  99. package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
  100. package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
@@ -1,45 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from 'prosemirror-state';
3
- export const pluginKey = new PluginKey('contextPanelPluginKey');
4
- function contextPanelPluginFactory(contextPanels, dispatch) {
5
- return new SafePlugin({
6
- key: pluginKey,
7
- state: {
8
- init(_config, state) {
9
- return {
10
- handlers: contextPanels,
11
- contents: contextPanels.map(panelContent => panelContent(state))
12
- };
13
- },
14
- apply(tr, pluginState, _oldState, newState) {
15
- let newPluginState = pluginState;
16
- const meta = tr.getMeta(pluginKey);
17
- if (tr.docChanged || tr.selectionSet || meta && meta.changed) {
18
- const newContents = pluginState.handlers.map(panelContent => panelContent(newState));
19
- if (newContents.length !== newPluginState.contents.length || newContents.some(node => newPluginState.contents.indexOf(node) < 0)) {
20
- newPluginState = {
21
- ...newPluginState,
22
- contents: newContents
23
- };
24
- }
25
- }
26
- if (newPluginState !== pluginState) {
27
- dispatch(pluginKey, newPluginState);
28
- }
29
- return newPluginState;
30
- }
31
- }
32
- });
33
- }
34
- const contextPanelPlugin = () => ({
35
- name: 'contextPanel',
36
- pmPlugins(contextPanels = []) {
37
- return [{
38
- name: 'contextPanel',
39
- plugin: ({
40
- dispatch
41
- }) => contextPanelPluginFactory(contextPanels.filter(Boolean), dispatch)
42
- }];
43
- }
44
- });
45
- export default contextPanelPlugin;
@@ -1,4 +0,0 @@
1
- import { pluginKey } from './';
2
- export const applyChange = tr => tr.setMeta(pluginKey, {
3
- changed: true
4
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,57 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import { PluginKey } from 'prosemirror-state';
6
- export var pluginKey = new PluginKey('contextPanelPluginKey');
7
- function contextPanelPluginFactory(contextPanels, dispatch) {
8
- return new SafePlugin({
9
- key: pluginKey,
10
- state: {
11
- init: function init(_config, state) {
12
- return {
13
- handlers: contextPanels,
14
- contents: contextPanels.map(function (panelContent) {
15
- return panelContent(state);
16
- })
17
- };
18
- },
19
- apply: function apply(tr, pluginState, _oldState, newState) {
20
- var newPluginState = pluginState;
21
- var meta = tr.getMeta(pluginKey);
22
- if (tr.docChanged || tr.selectionSet || meta && meta.changed) {
23
- var newContents = pluginState.handlers.map(function (panelContent) {
24
- return panelContent(newState);
25
- });
26
- if (newContents.length !== newPluginState.contents.length || newContents.some(function (node) {
27
- return newPluginState.contents.indexOf(node) < 0;
28
- })) {
29
- newPluginState = _objectSpread(_objectSpread({}, newPluginState), {}, {
30
- contents: newContents
31
- });
32
- }
33
- }
34
- if (newPluginState !== pluginState) {
35
- dispatch(pluginKey, newPluginState);
36
- }
37
- return newPluginState;
38
- }
39
- }
40
- });
41
- }
42
- var contextPanelPlugin = function contextPanelPlugin() {
43
- return {
44
- name: 'contextPanel',
45
- pmPlugins: function pmPlugins() {
46
- var contextPanels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
47
- return [{
48
- name: 'contextPanel',
49
- plugin: function plugin(_ref) {
50
- var dispatch = _ref.dispatch;
51
- return contextPanelPluginFactory(contextPanels.filter(Boolean), dispatch);
52
- }
53
- }];
54
- }
55
- };
56
- };
57
- export default contextPanelPlugin;
@@ -1,6 +0,0 @@
1
- import { pluginKey } from './';
2
- export var applyChange = function applyChange(tr) {
3
- return tr.setMeta(pluginKey, {
4
- changed: true
5
- });
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { PluginKey } from 'prosemirror-state';
3
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- import { ContextPanelHandler } from './types';
5
- export declare const pluginKey: PluginKey<ContextPanelPluginState, any>;
6
- type ContextPanelPluginState = {
7
- handlers: ContextPanelHandler[];
8
- contents: React.ReactNode[];
9
- };
10
- declare const contextPanelPlugin: NextEditorPlugin<'contextPanel'>;
11
- export default contextPanelPlugin;
@@ -1,2 +0,0 @@
1
- import { Transaction } from 'prosemirror-state';
2
- export declare const applyChange: (tr: Transaction) => Transaction;
@@ -1 +0,0 @@
1
- export type { ContextPanelHandler } from '@atlaskit/editor-common/types';
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { PluginKey } from 'prosemirror-state';
3
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- import { ContextPanelHandler } from './types';
5
- export declare const pluginKey: PluginKey<ContextPanelPluginState, any>;
6
- type ContextPanelPluginState = {
7
- handlers: ContextPanelHandler[];
8
- contents: React.ReactNode[];
9
- };
10
- declare const contextPanelPlugin: NextEditorPlugin<'contextPanel'>;
11
- export default contextPanelPlugin;
@@ -1,2 +0,0 @@
1
- import { Transaction } from 'prosemirror-state';
2
- export declare const applyChange: (tr: Transaction) => Transaction;
@@ -1 +0,0 @@
1
- export type { ContextPanelHandler } from '@atlaskit/editor-common/types';