@atlaskit/editor-plugin-synced-block 3.5.1 → 3.6.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 +17 -0
- package/dist/cjs/nodeviews/bodiedLazySyncedBlock.js +26 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +87 -0
- package/dist/cjs/nodeviews/syncedBlock.js +8 -115
- package/dist/cjs/pm-plugins/actions.js +48 -40
- package/dist/cjs/pm-plugins/main.js +8 -2
- package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +8 -0
- package/dist/cjs/pm-plugins/utils/utils.js +12 -2
- package/dist/cjs/syncedBlockPlugin.js +3 -0
- package/dist/cjs/ui/BodiedSyncBlockWrapper.js +25 -0
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +15 -2
- package/dist/cjs/ui/SyncBlockLabel.js +3 -2
- package/dist/cjs/ui/floating-toolbar.js +5 -3
- package/dist/es2019/nodeviews/bodiedLazySyncedBlock.js +16 -0
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +62 -0
- package/dist/es2019/nodeviews/syncedBlock.js +7 -96
- package/dist/es2019/pm-plugins/actions.js +56 -46
- package/dist/es2019/pm-plugins/main.js +8 -2
- package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +8 -0
- package/dist/es2019/pm-plugins/utils/utils.js +11 -1
- package/dist/es2019/syncedBlockPlugin.js +4 -1
- package/dist/es2019/ui/BodiedSyncBlockWrapper.js +19 -0
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +16 -2
- package/dist/es2019/ui/SyncBlockLabel.js +3 -2
- package/dist/es2019/ui/floating-toolbar.js +12 -4
- package/dist/esm/nodeviews/bodiedLazySyncedBlock.js +15 -0
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +80 -0
- package/dist/esm/nodeviews/syncedBlock.js +9 -116
- package/dist/esm/pm-plugins/actions.js +47 -39
- package/dist/esm/pm-plugins/main.js +8 -2
- package/dist/esm/pm-plugins/utils/track-sync-blocks.js +8 -0
- package/dist/esm/pm-plugins/utils/utils.js +11 -1
- package/dist/esm/syncedBlockPlugin.js +4 -1
- package/dist/esm/ui/BodiedSyncBlockWrapper.js +18 -0
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +15 -2
- package/dist/esm/ui/SyncBlockLabel.js +3 -2
- package/dist/esm/ui/floating-toolbar.js +6 -4
- package/dist/types/nodeviews/bodiedLazySyncedBlock.d.ts +3 -0
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +25 -0
- package/dist/types/nodeviews/syncedBlock.d.ts +1 -20
- package/dist/types/pm-plugins/utils/utils.d.ts +6 -2
- package/dist/types/syncedBlockPluginType.d.ts +2 -0
- package/dist/types/ui/BodiedSyncBlockWrapper.d.ts +9 -0
- package/dist/types-ts4.5/nodeviews/bodiedLazySyncedBlock.d.ts +3 -0
- package/dist/types-ts4.5/nodeviews/bodiedSyncedBlock.d.ts +25 -0
- package/dist/types-ts4.5/nodeviews/syncedBlock.d.ts +1 -20
- package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +6 -2
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -0
- package/dist/types-ts4.5/ui/BodiedSyncBlockWrapper.d.ts +9 -0
- package/package.json +6 -6
- package/dist/cjs/ui/SyncBlockEditorWrapper.js +0 -45
- package/dist/es2019/ui/SyncBlockEditorWrapper.js +0 -29
- package/dist/esm/ui/SyncBlockEditorWrapper.js +0 -36
- package/dist/types/ui/SyncBlockEditorWrapper.d.ts +0 -16
- package/dist/types-ts4.5/ui/SyncBlockEditorWrapper.d.ts +0 -16
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import {
|
|
4
|
-
export declare const findSyncBlock: (state: EditorState, selection?: Selection | null) =>
|
|
4
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
export declare const findSyncBlock: (state: EditorState, selection?: Selection | null) => ContentNodeWithPos | undefined;
|
|
6
|
+
export declare const findBodiedSyncBlock: (state: EditorState, selection?: Selection | null) => ContentNodeWithPos | undefined;
|
|
7
|
+
export declare const findSyncBlockOrBodiedSyncBlock: (state: EditorState, selection?: Selection | null) => ContentNodeWithPos | undefined;
|
|
8
|
+
export declare const isBodiedSyncBlockNode: (node: PMNode, bodiedSyncBlock: NodeType) => boolean;
|
|
5
9
|
export interface SyncBlockConversionInfo {
|
|
6
10
|
contentToInclude: Fragment;
|
|
7
11
|
from: number;
|
|
@@ -3,6 +3,7 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
3
3
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
5
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
6
7
|
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
7
8
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
8
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
@@ -47,6 +48,7 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
|
47
48
|
SelectionPlugin,
|
|
48
49
|
FloatingToolbarPlugin,
|
|
49
50
|
DecorationsPlugin,
|
|
51
|
+
OptionalPlugin<BlockControlsPlugin>,
|
|
50
52
|
OptionalPlugin<BlockMenuPlugin>,
|
|
51
53
|
OptionalPlugin<AnalyticsPlugin>
|
|
52
54
|
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import { type SyncBlockDataProvider } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
interface BodiedSyncBlockWrapperProps {
|
|
5
|
+
dataProvider?: SyncBlockDataProvider | undefined;
|
|
6
|
+
node: PMNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const BodiedSyncBlockWrapper: React.ForwardRefExoticComponent<BodiedSyncBlockWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
"@atlaskit/button": "23.5.3",
|
|
33
33
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
35
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
35
|
+
"@atlaskit/editor-plugin-block-menu": "^5.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-floating-toolbar": "^8.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
41
|
-
"@atlaskit/editor-synced-block-provider": "^0.
|
|
40
|
+
"@atlaskit/editor-shared-styles": "^3.8.0",
|
|
41
|
+
"@atlaskit/editor-synced-block-provider": "^1.0.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
43
|
"@atlaskit/editor-toolbar": "^0.15.0",
|
|
44
|
-
"@atlaskit/icon": "28.5.
|
|
44
|
+
"@atlaskit/icon": "28.5.3",
|
|
45
45
|
"@atlaskit/modal-dialog": "^14.5.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^110.
|
|
50
|
+
"@atlaskit/editor-common": "^110.15.0",
|
|
51
51
|
"react": "^18.2.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.SyncBlockEditorWrapperDataId = exports.SyncBlockEditorWrapper = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
12
|
-
var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
13
|
-
var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
14
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
-
var SyncBlockEditorWrapperDataId = exports.SyncBlockEditorWrapperDataId = 'sync-block-plugin-editor-wrapper';
|
|
16
|
-
var SyncBlockEditorWrapperComponent = function SyncBlockEditorWrapperComponent(_ref) {
|
|
17
|
-
var defaultDocument = _ref.defaultDocument,
|
|
18
|
-
getSyncedBlockEditor = _ref.getSyncedBlockEditor,
|
|
19
|
-
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
20
|
-
popupsMountPoint = _ref.popupsMountPoint,
|
|
21
|
-
setInnerEditorView = _ref.setInnerEditorView,
|
|
22
|
-
useHandleContentChanges = _ref.useHandleContentChanges;
|
|
23
|
-
var _useState = (0, _react.useState)(new _editorJsonTransformer.JSONTransformer().parse(defaultDocument)),
|
|
24
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
-
updatedDoc = _useState2[0],
|
|
26
|
-
setUpdatedDoc = _useState2[1];
|
|
27
|
-
useHandleContentChanges(updatedDoc);
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
-
"data-testid": SyncBlockEditorWrapperDataId
|
|
30
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
31
|
-
,
|
|
32
|
-
className: _syncBlock.SyncBlockSharedCssClassName.editor
|
|
33
|
-
}, getSyncedBlockEditor({
|
|
34
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
35
|
-
defaultDocument: defaultDocument,
|
|
36
|
-
popupsMountPoint: popupsMountPoint,
|
|
37
|
-
onChange: function onChange(value) {
|
|
38
|
-
return setUpdatedDoc(value.state.doc);
|
|
39
|
-
},
|
|
40
|
-
onEditorReady: function onEditorReady(value) {
|
|
41
|
-
return setInnerEditorView(value.editorView);
|
|
42
|
-
}
|
|
43
|
-
})));
|
|
44
|
-
};
|
|
45
|
-
var SyncBlockEditorWrapper = exports.SyncBlockEditorWrapper = /*#__PURE__*/_react.default.memo(SyncBlockEditorWrapperComponent);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
|
-
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
4
|
-
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
5
|
-
export const SyncBlockEditorWrapperDataId = 'sync-block-plugin-editor-wrapper';
|
|
6
|
-
const SyncBlockEditorWrapperComponent = ({
|
|
7
|
-
defaultDocument,
|
|
8
|
-
getSyncedBlockEditor,
|
|
9
|
-
popupsBoundariesElement,
|
|
10
|
-
popupsMountPoint,
|
|
11
|
-
setInnerEditorView,
|
|
12
|
-
useHandleContentChanges
|
|
13
|
-
}) => {
|
|
14
|
-
const [updatedDoc, setUpdatedDoc] = useState(new JSONTransformer().parse(defaultDocument));
|
|
15
|
-
useHandleContentChanges(updatedDoc);
|
|
16
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SyncBlockLabel, null), /*#__PURE__*/React.createElement("div", {
|
|
17
|
-
"data-testid": SyncBlockEditorWrapperDataId
|
|
18
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
19
|
-
,
|
|
20
|
-
className: SyncBlockSharedCssClassName.editor
|
|
21
|
-
}, getSyncedBlockEditor({
|
|
22
|
-
popupsBoundariesElement,
|
|
23
|
-
defaultDocument,
|
|
24
|
-
popupsMountPoint,
|
|
25
|
-
onChange: value => setUpdatedDoc(value.state.doc),
|
|
26
|
-
onEditorReady: value => setInnerEditorView(value.editorView)
|
|
27
|
-
})));
|
|
28
|
-
};
|
|
29
|
-
export const SyncBlockEditorWrapper = /*#__PURE__*/React.memo(SyncBlockEditorWrapperComponent);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
4
|
-
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
5
|
-
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
6
|
-
export var SyncBlockEditorWrapperDataId = 'sync-block-plugin-editor-wrapper';
|
|
7
|
-
var SyncBlockEditorWrapperComponent = function SyncBlockEditorWrapperComponent(_ref) {
|
|
8
|
-
var defaultDocument = _ref.defaultDocument,
|
|
9
|
-
getSyncedBlockEditor = _ref.getSyncedBlockEditor,
|
|
10
|
-
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
11
|
-
popupsMountPoint = _ref.popupsMountPoint,
|
|
12
|
-
setInnerEditorView = _ref.setInnerEditorView,
|
|
13
|
-
useHandleContentChanges = _ref.useHandleContentChanges;
|
|
14
|
-
var _useState = useState(new JSONTransformer().parse(defaultDocument)),
|
|
15
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
-
updatedDoc = _useState2[0],
|
|
17
|
-
setUpdatedDoc = _useState2[1];
|
|
18
|
-
useHandleContentChanges(updatedDoc);
|
|
19
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SyncBlockLabel, null), /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
"data-testid": SyncBlockEditorWrapperDataId
|
|
21
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
22
|
-
,
|
|
23
|
-
className: SyncBlockSharedCssClassName.editor
|
|
24
|
-
}, getSyncedBlockEditor({
|
|
25
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
26
|
-
defaultDocument: defaultDocument,
|
|
27
|
-
popupsMountPoint: popupsMountPoint,
|
|
28
|
-
onChange: function onChange(value) {
|
|
29
|
-
return setUpdatedDoc(value.state.doc);
|
|
30
|
-
},
|
|
31
|
-
onEditorReady: function onEditorReady(value) {
|
|
32
|
-
return setInnerEditorView(value.editorView);
|
|
33
|
-
}
|
|
34
|
-
})));
|
|
35
|
-
};
|
|
36
|
-
export var SyncBlockEditorWrapper = /*#__PURE__*/React.memo(SyncBlockEditorWrapperComponent);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { SyncedBlockEditorProps } from '../syncedBlockPluginType';
|
|
6
|
-
type Props = {
|
|
7
|
-
defaultDocument: JSONDocNode;
|
|
8
|
-
getSyncedBlockEditor: (props: SyncedBlockEditorProps) => React.JSX.Element;
|
|
9
|
-
popupsBoundariesElement: HTMLElement;
|
|
10
|
-
popupsMountPoint: HTMLElement;
|
|
11
|
-
setInnerEditorView: (editorView: EditorView) => void;
|
|
12
|
-
useHandleContentChanges: (updatedDoc: PMNode) => void;
|
|
13
|
-
};
|
|
14
|
-
export declare const SyncBlockEditorWrapperDataId = "sync-block-plugin-editor-wrapper";
|
|
15
|
-
export declare const SyncBlockEditorWrapper: React.MemoExoticComponent<({ defaultDocument, getSyncedBlockEditor, popupsBoundariesElement, popupsMountPoint, setInnerEditorView, useHandleContentChanges, }: Props) => React.JSX.Element>;
|
|
16
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { SyncedBlockEditorProps } from '../syncedBlockPluginType';
|
|
6
|
-
type Props = {
|
|
7
|
-
defaultDocument: JSONDocNode;
|
|
8
|
-
getSyncedBlockEditor: (props: SyncedBlockEditorProps) => React.JSX.Element;
|
|
9
|
-
popupsBoundariesElement: HTMLElement;
|
|
10
|
-
popupsMountPoint: HTMLElement;
|
|
11
|
-
setInnerEditorView: (editorView: EditorView) => void;
|
|
12
|
-
useHandleContentChanges: (updatedDoc: PMNode) => void;
|
|
13
|
-
};
|
|
14
|
-
export declare const SyncBlockEditorWrapperDataId = "sync-block-plugin-editor-wrapper";
|
|
15
|
-
export declare const SyncBlockEditorWrapper: React.MemoExoticComponent<({ defaultDocument, getSyncedBlockEditor, popupsBoundariesElement, popupsMountPoint, setInnerEditorView, useHandleContentChanges, }: Props) => React.JSX.Element>;
|
|
16
|
-
export {};
|