@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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +54 -5
- package/dist/cjs/labs/next/presets/universal.js +6 -5
- package/dist/cjs/plugins/extension/actions.js +6 -4
- package/dist/cjs/plugins/extension/commands.js +19 -16
- package/dist/cjs/plugins/extension/context-panel.js +4 -4
- package/dist/cjs/plugins/extension/extension-api.js +1 -1
- package/dist/cjs/plugins/extension/index.js +11 -4
- package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/cjs/plugins/extension/toolbar.js +8 -6
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/ui/ContextPanel/index.js +9 -2
- package/dist/cjs/utils/action.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +54 -5
- package/dist/es2019/labs/next/presets/universal.js +7 -6
- package/dist/es2019/plugins/extension/actions.js +6 -4
- package/dist/es2019/plugins/extension/commands.js +6 -7
- package/dist/es2019/plugins/extension/context-panel.js +4 -4
- package/dist/es2019/plugins/extension/extension-api.js +1 -1
- package/dist/es2019/plugins/extension/index.js +11 -4
- package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/es2019/plugins/extension/toolbar.js +8 -4
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/ui/ContextPanel/index.js +8 -1
- package/dist/es2019/utils/action.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/editor-next/hooks/useProviderFactory.js +54 -5
- package/dist/esm/labs/next/presets/universal.js +7 -6
- package/dist/esm/plugins/extension/actions.js +6 -4
- package/dist/esm/plugins/extension/commands.js +18 -15
- package/dist/esm/plugins/extension/context-panel.js +4 -4
- package/dist/esm/plugins/extension/extension-api.js +1 -1
- package/dist/esm/plugins/extension/index.js +11 -4
- package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/esm/plugins/extension/toolbar.js +8 -6
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/ui/ContextPanel/index.js +8 -1
- package/dist/esm/utils/action.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +0 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
- package/dist/types/labs/next/presets/default.d.ts +36 -4
- package/dist/types/labs/next/presets/mobile.d.ts +18 -2
- package/dist/types/plugins/extension/actions.d.ts +2 -1
- package/dist/types/plugins/extension/commands.d.ts +4 -3
- package/dist/types/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types/plugins/extension/index.d.ts +4 -2
- package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types/plugins/extension/types.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
- package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
- package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/package.json +4 -3
- package/dist/cjs/plugins/context-panel/index.js +0 -66
- package/dist/cjs/plugins/context-panel/transforms.js +0 -13
- package/dist/cjs/plugins/context-panel/types.js +0 -5
- package/dist/es2019/plugins/context-panel/index.js +0 -45
- package/dist/es2019/plugins/context-panel/transforms.js +0 -4
- package/dist/es2019/plugins/context-panel/types.js +0 -1
- package/dist/esm/plugins/context-panel/index.js +0 -57
- package/dist/esm/plugins/context-panel/transforms.js +0 -6
- package/dist/esm/plugins/context-panel/types.js +0 -1
- package/dist/types/plugins/context-panel/index.d.ts +0 -11
- package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types/plugins/context-panel/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
- 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 +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 +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 +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 +0,0 @@
|
|
|
1
|
-
export type { ContextPanelHandler } from '@atlaskit/editor-common/types';
|