@atlaskit/editor-plugin-synced-block 1.0.0 → 2.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 +8 -16
- package/afm-cc/tsconfig.json +0 -12
- package/afm-dev-agents/tsconfig.json +0 -12
- package/afm-jira/tsconfig.json +0 -12
- package/afm-passionfruit/tsconfig.json +0 -12
- package/afm-post-office/tsconfig.json +0 -12
- package/afm-rovo-extension/tsconfig.json +0 -12
- package/afm-townsquare/tsconfig.json +0 -12
- package/dist/cjs/nodeviews/lazySyncedBlock.js +26 -0
- package/dist/cjs/nodeviews/syncedBlock.js +137 -0
- package/dist/cjs/pm-plugins/actions.js +25 -0
- package/dist/cjs/pm-plugins/main.js +10 -22
- package/dist/cjs/syncedBlockPlugin.js +35 -5
- package/dist/cjs/ui/floating-toolbar.js +11 -0
- package/dist/es2019/nodeviews/lazySyncedBlock.js +16 -0
- package/dist/es2019/nodeviews/syncedBlock.js +105 -0
- package/dist/es2019/pm-plugins/actions.js +19 -0
- package/dist/es2019/pm-plugins/main.js +10 -25
- package/dist/es2019/syncedBlockPlugin.js +38 -15
- package/dist/es2019/ui/floating-toolbar.js +3 -0
- package/dist/esm/nodeviews/lazySyncedBlock.js +15 -0
- package/dist/esm/nodeviews/syncedBlock.js +129 -0
- package/dist/esm/pm-plugins/actions.js +19 -0
- package/dist/esm/pm-plugins/main.js +10 -22
- package/dist/esm/syncedBlockPlugin.js +35 -5
- package/dist/esm/ui/floating-toolbar.js +5 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/types/nodeviews/lazySyncedBlock.d.ts +3 -0
- package/dist/types/nodeviews/syncedBlock.d.ts +28 -0
- package/dist/types/pm-plugins/actions.d.ts +2 -0
- package/dist/types/pm-plugins/main.d.ts +3 -1
- package/dist/types/syncedBlockPluginType.d.ts +36 -1
- package/dist/types/ui/floating-toolbar.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/lazySyncedBlock.d.ts +3 -0
- package/dist/types-ts4.5/nodeviews/syncedBlock.d.ts +28 -0
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +36 -1
- package/dist/types-ts4.5/ui/floating-toolbar.d.ts +2 -0
- package/package.json +5 -9
- package/SyncedBlock/package.json +0 -15
- package/dist/cjs/pm-plugins/SyncClient.js +0 -167
- package/dist/cjs/pm-plugins/utils.js +0 -19
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/ui/extensions/synced-block/components/GlobalStyles.js +0 -25
- package/dist/cjs/ui/extensions/synced-block/components/SyncedBlockLiveView.js +0 -25
- package/dist/cjs/ui/extensions/synced-block/components/SyncedBlockRenderer.js +0 -25
- package/dist/cjs/ui/extensions/synced-block/constants.js +0 -32
- package/dist/cjs/ui/extensions/synced-block/getSyncedBlockExtensionProvider.js +0 -11
- package/dist/cjs/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.js +0 -29
- package/dist/cjs/ui/extensions/synced-block/hooks/usePollContentProperty.js +0 -121
- package/dist/cjs/ui/extensions/synced-block/index.js +0 -19
- package/dist/cjs/ui/extensions/synced-block/manifest.js +0 -281
- package/dist/cjs/ui/extensions/synced-block/utils/ari.js +0 -29
- package/dist/cjs/ui/extensions/synced-block/utils/content-property.js +0 -159
- package/dist/cjs/ui/extensions/synced-block/utils/synced-block.js +0 -65
- package/dist/es2019/pm-plugins/SyncClient.js +0 -102
- package/dist/es2019/pm-plugins/utils.js +0 -13
- package/dist/es2019/types/index.js +0 -0
- package/dist/es2019/ui/extensions/synced-block/components/GlobalStyles.js +0 -18
- package/dist/es2019/ui/extensions/synced-block/components/SyncedBlockLiveView.js +0 -19
- package/dist/es2019/ui/extensions/synced-block/components/SyncedBlockRenderer.js +0 -19
- package/dist/es2019/ui/extensions/synced-block/constants.js +0 -26
- package/dist/es2019/ui/extensions/synced-block/getSyncedBlockExtensionProvider.js +0 -5
- package/dist/es2019/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.js +0 -24
- package/dist/es2019/ui/extensions/synced-block/hooks/usePollContentProperty.js +0 -107
- package/dist/es2019/ui/extensions/synced-block/index.js +0 -5
- package/dist/es2019/ui/extensions/synced-block/manifest.js +0 -172
- package/dist/es2019/ui/extensions/synced-block/utils/ari.js +0 -19
- package/dist/es2019/ui/extensions/synced-block/utils/content-property.js +0 -108
- package/dist/es2019/ui/extensions/synced-block/utils/synced-block.js +0 -57
- package/dist/esm/pm-plugins/SyncClient.js +0 -160
- package/dist/esm/pm-plugins/utils.js +0 -13
- package/dist/esm/types/index.js +0 -0
- package/dist/esm/ui/extensions/synced-block/components/GlobalStyles.js +0 -18
- package/dist/esm/ui/extensions/synced-block/components/SyncedBlockLiveView.js +0 -18
- package/dist/esm/ui/extensions/synced-block/components/SyncedBlockRenderer.js +0 -18
- package/dist/esm/ui/extensions/synced-block/constants.js +0 -26
- package/dist/esm/ui/extensions/synced-block/getSyncedBlockExtensionProvider.js +0 -5
- package/dist/esm/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.js +0 -23
- package/dist/esm/ui/extensions/synced-block/hooks/usePollContentProperty.js +0 -114
- package/dist/esm/ui/extensions/synced-block/index.js +0 -5
- package/dist/esm/ui/extensions/synced-block/manifest.js +0 -274
- package/dist/esm/ui/extensions/synced-block/utils/ari.js +0 -23
- package/dist/esm/ui/extensions/synced-block/utils/content-property.js +0 -153
- package/dist/esm/ui/extensions/synced-block/utils/synced-block.js +0 -58
- package/dist/types/pm-plugins/SyncClient.d.ts +0 -14
- package/dist/types/pm-plugins/utils.d.ts +0 -5
- package/dist/types/types/index.d.ts +0 -3
- package/dist/types/ui/extensions/synced-block/components/GlobalStyles.d.ts +0 -6
- package/dist/types/ui/extensions/synced-block/components/SyncedBlockLiveView.d.ts +0 -7
- package/dist/types/ui/extensions/synced-block/components/SyncedBlockRenderer.d.ts +0 -7
- package/dist/types/ui/extensions/synced-block/constants.d.ts +0 -8
- package/dist/types/ui/extensions/synced-block/getSyncedBlockExtensionProvider.d.ts +0 -3
- package/dist/types/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.d.ts +0 -6
- package/dist/types/ui/extensions/synced-block/hooks/usePollContentProperty.d.ts +0 -7
- package/dist/types/ui/extensions/synced-block/index.d.ts +0 -2
- package/dist/types/ui/extensions/synced-block/manifest.d.ts +0 -3
- package/dist/types/ui/extensions/synced-block/utils/ari.d.ts +0 -4
- package/dist/types/ui/extensions/synced-block/utils/content-property.d.ts +0 -33
- package/dist/types/ui/extensions/synced-block/utils/synced-block.d.ts +0 -24
- package/dist/types-ts4.5/pm-plugins/SyncClient.d.ts +0 -14
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +0 -5
- package/dist/types-ts4.5/types/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/extensions/synced-block/components/GlobalStyles.d.ts +0 -6
- package/dist/types-ts4.5/ui/extensions/synced-block/components/SyncedBlockLiveView.d.ts +0 -7
- package/dist/types-ts4.5/ui/extensions/synced-block/components/SyncedBlockRenderer.d.ts +0 -7
- package/dist/types-ts4.5/ui/extensions/synced-block/constants.d.ts +0 -8
- package/dist/types-ts4.5/ui/extensions/synced-block/getSyncedBlockExtensionProvider.d.ts +0 -3
- package/dist/types-ts4.5/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.d.ts +0 -6
- package/dist/types-ts4.5/ui/extensions/synced-block/hooks/usePollContentProperty.d.ts +0 -7
- package/dist/types-ts4.5/ui/extensions/synced-block/index.d.ts +0 -2
- package/dist/types-ts4.5/ui/extensions/synced-block/manifest.d.ts +0 -3
- package/dist/types-ts4.5/ui/extensions/synced-block/utils/ari.d.ts +0 -4
- package/dist/types-ts4.5/ui/extensions/synced-block/utils/content-property.d.ts +0 -33
- package/dist/types-ts4.5/ui/extensions/synced-block/utils/synced-block.d.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- [`1a1f634a70d97`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1a1f634a70d97) -
|
|
8
|
+
Added Sync Block Editor and Sync Block Renderer
|
|
7
9
|
- Updated dependencies
|
|
8
10
|
|
|
9
|
-
## 0.
|
|
11
|
+
## 2.0.0
|
|
10
12
|
|
|
11
13
|
### Patch Changes
|
|
12
14
|
|
|
13
|
-
- [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
|
|
14
|
-
EDITOR-1442 Bump adf-schema
|
|
15
15
|
- Updated dependencies
|
|
16
16
|
|
|
17
|
-
## 0.
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- [`7ce112e18ca29`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ce112e18ca29) -
|
|
22
|
-
[ux] Copy the sync block reference to clipboard
|
|
23
|
-
- Updated dependencies
|
|
24
|
-
|
|
25
|
-
## 0.1.0
|
|
17
|
+
## 1.0.0
|
|
26
18
|
|
|
27
|
-
###
|
|
19
|
+
### Major Changes
|
|
28
20
|
|
|
29
|
-
- [`
|
|
30
|
-
|
|
21
|
+
- [`168d76bdf8be6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/168d76bdf8be6) -
|
|
22
|
+
Created new synced-block plugin (scaffolding only)
|
|
31
23
|
|
|
32
24
|
### Patch Changes
|
|
33
25
|
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-cc/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-cc/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-cc/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-cc/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-cc/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
42
30
|
}
|
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-dev-agents/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-dev-agents/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-dev-agents/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-dev-agents/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-dev-agents/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-dev-agents/tsconfig.json"
|
|
42
30
|
}
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-jira/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-jira/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-jira/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-jira/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-jira/tsconfig.json"
|
|
42
30
|
}
|
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-passionfruit/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-passionfruit/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-passionfruit/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-passionfruit/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-passionfruit/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-passionfruit/tsconfig.json"
|
|
42
30
|
}
|
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-post-office/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-post-office/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-post-office/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-post-office/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-post-office/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
42
30
|
}
|
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-rovo-extension/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-rovo-extension/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-rovo-extension/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-rovo-extension/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-rovo-extension/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-rovo-extension/tsconfig.json"
|
|
42
30
|
}
|
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
"../src/**/stories/**/*"
|
|
23
23
|
],
|
|
24
24
|
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-utils/afm-townsquare/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-townsquare/tsconfig.json"
|
|
30
|
-
},
|
|
31
25
|
{
|
|
32
26
|
"path": "../../../design-system/icon/afm-townsquare/tsconfig.json"
|
|
33
27
|
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../renderer/afm-townsquare/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
|
|
39
|
-
},
|
|
40
28
|
{
|
|
41
29
|
"path": "../../editor-common/afm-townsquare/tsconfig.json"
|
|
42
30
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.lazySyncBlockView = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
|
+
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" != (0, _typeof2.default)(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); }
|
|
11
|
+
var lazySyncBlockView = exports.lazySyncBlockView = function lazySyncBlockView(props) {
|
|
12
|
+
return (0, _lazyNodeView.withLazyLoading)({
|
|
13
|
+
nodeName: 'syncBlock',
|
|
14
|
+
getNodeViewOptions: function getNodeViewOptions() {},
|
|
15
|
+
loader: function loader() {
|
|
16
|
+
var result = Promise.resolve().then(function () {
|
|
17
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-synced-block-nodeview" */
|
|
18
|
+
'./syncedBlock'));
|
|
19
|
+
}).then(function (_ref) {
|
|
20
|
+
var syncBlockNodeView = _ref.syncBlockNodeView;
|
|
21
|
+
return syncBlockNodeView(props);
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
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.syncBlockNodeView = exports.defaultSyncBlockDocument = exports.SyncBlockPluginComponent = void 0;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
18
|
+
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); }
|
|
19
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } /* eslint-disable @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
22
|
+
var defaultSyncBlockDocument = exports.defaultSyncBlockDocument = {
|
|
23
|
+
version: 1,
|
|
24
|
+
type: 'doc',
|
|
25
|
+
content: [{
|
|
26
|
+
type: 'paragraph',
|
|
27
|
+
content: [{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: 'This is a synced block. Edit the source to update the content.'
|
|
30
|
+
}]
|
|
31
|
+
}]
|
|
32
|
+
};
|
|
33
|
+
var SyncBlockEditorWrapperDataId = 'sync-block-plugin-editor-wrapper';
|
|
34
|
+
var SyncBlockPluginComponent = exports.SyncBlockPluginComponent = function SyncBlockPluginComponent(_ref) {
|
|
35
|
+
var config = _ref.config,
|
|
36
|
+
dom = _ref.dom;
|
|
37
|
+
var innerEditorView = (0, _react.useRef)(null);
|
|
38
|
+
|
|
39
|
+
/* Tmp solution to demonstrate the synced block renderer */
|
|
40
|
+
var _useState = (0, _react.useState)(defaultSyncBlockDocument),
|
|
41
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
+
rendererDocument = _useState2[0],
|
|
43
|
+
setRendererDocument = _useState2[1];
|
|
44
|
+
var onChange = function onChange(editorView, _meta) {
|
|
45
|
+
var content = editorView.state.doc.toJSON().content;
|
|
46
|
+
var rendererDocument = {
|
|
47
|
+
version: 1,
|
|
48
|
+
type: 'doc',
|
|
49
|
+
content: content
|
|
50
|
+
};
|
|
51
|
+
setRendererDocument(rendererDocument);
|
|
52
|
+
};
|
|
53
|
+
var onEditorReady = function onEditorReady(_ref2) {
|
|
54
|
+
var editorView = _ref2.editorView;
|
|
55
|
+
innerEditorView.current = editorView || null;
|
|
56
|
+
};
|
|
57
|
+
var boundariesElement = (0, _react.useMemo)(function () {
|
|
58
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
59
|
+
return dom.closest('.fabric-editor-popup-scroll-parent');
|
|
60
|
+
}, [dom]);
|
|
61
|
+
if (!boundariesElement || !(boundariesElement instanceof HTMLElement)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (!(config !== null && config !== void 0 && config.getSyncedBlockEditor) || !(config !== null && config !== void 0 && config.getSyncedBlockRenderer)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
"data-testid": SyncBlockEditorWrapperDataId
|
|
69
|
+
}, config.getSyncedBlockEditor({
|
|
70
|
+
boundariesElement: boundariesElement,
|
|
71
|
+
defaultDocument: defaultSyncBlockDocument,
|
|
72
|
+
mountPoint: dom,
|
|
73
|
+
onChange: onChange,
|
|
74
|
+
onEditorReady: onEditorReady
|
|
75
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
+
style: {
|
|
77
|
+
width: '100%',
|
|
78
|
+
height: '1px',
|
|
79
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
80
|
+
backgroundColor: 'purple'
|
|
81
|
+
}
|
|
82
|
+
}), config.getSyncedBlockRenderer({
|
|
83
|
+
docNode: rendererDocument
|
|
84
|
+
}));
|
|
85
|
+
};
|
|
86
|
+
var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
87
|
+
function SyncBlock() {
|
|
88
|
+
(0, _classCallCheck2.default)(this, SyncBlock);
|
|
89
|
+
return _callSuper(this, SyncBlock, arguments);
|
|
90
|
+
}
|
|
91
|
+
(0, _inherits2.default)(SyncBlock, _ReactNodeView);
|
|
92
|
+
return (0, _createClass2.default)(SyncBlock, [{
|
|
93
|
+
key: "createDomRef",
|
|
94
|
+
value: function createDomRef() {
|
|
95
|
+
var domRef = document.createElement('div');
|
|
96
|
+
domRef.setAttribute('style', 'border: purple solid 1px;');
|
|
97
|
+
return domRef;
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "render",
|
|
101
|
+
value: function render() {
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(SyncBlockPluginComponent, {
|
|
103
|
+
config: this.reactComponentProps.config,
|
|
104
|
+
dom: this.dom
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "stopEvent",
|
|
109
|
+
value: function stopEvent(event) {
|
|
110
|
+
var _target$closest;
|
|
111
|
+
var target = event.target;
|
|
112
|
+
if (!target) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return ((_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, "[data-testid=\"".concat(SyncBlockEditorWrapperDataId, "\"]"))) != null;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "destroy",
|
|
119
|
+
value: function destroy() {
|
|
120
|
+
var _this$unsubscribe;
|
|
121
|
+
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
|
|
122
|
+
_superPropGet(SyncBlock, "destroy", this, 3)([]);
|
|
123
|
+
}
|
|
124
|
+
}]);
|
|
125
|
+
}(_reactNodeView.default);
|
|
126
|
+
var syncBlockNodeView = exports.syncBlockNodeView = function syncBlockNodeView(_ref3) {
|
|
127
|
+
var config = _ref3.config,
|
|
128
|
+
pmPluginFactoryParams = _ref3.pmPluginFactoryParams;
|
|
129
|
+
return function (node, view, getPos) {
|
|
130
|
+
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
131
|
+
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
132
|
+
var reactComponentProps = {
|
|
133
|
+
config: config
|
|
134
|
+
};
|
|
135
|
+
return new SyncBlock(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
|
|
136
|
+
};
|
|
137
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSyncedBlock = void 0;
|
|
7
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var getRandomId = function getRandomId() {
|
|
9
|
+
if (!globalThis.crypto || typeof globalThis.crypto.randomUUID !== 'function') {
|
|
10
|
+
return new Date().toISOString();
|
|
11
|
+
}
|
|
12
|
+
return globalThis.crypto.randomUUID();
|
|
13
|
+
};
|
|
14
|
+
var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(state) {
|
|
15
|
+
var tr = state.tr;
|
|
16
|
+
// const { breakout } = state.schema.marks;
|
|
17
|
+
var node = state.schema.nodes.syncBlock.createChecked({
|
|
18
|
+
resourceId: getRandomId(),
|
|
19
|
+
localId: getRandomId()
|
|
20
|
+
}, null
|
|
21
|
+
// [breakout.create({ mode: 'wide' })],
|
|
22
|
+
);
|
|
23
|
+
(0, _utils.safeInsert)(node)(tr);
|
|
24
|
+
return tr;
|
|
25
|
+
};
|
|
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.syncedBlockPluginKey = exports.createPlugin = void 0;
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var
|
|
10
|
-
var _utils = require("./utils");
|
|
9
|
+
var _lazySyncedBlock = require("../nodeviews/lazySyncedBlock");
|
|
11
10
|
var syncedBlockPluginKey = exports.syncedBlockPluginKey = new _state.PluginKey('syncedBlockPlugin');
|
|
12
11
|
|
|
13
12
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
14
13
|
|
|
15
|
-
var createPlugin = exports.createPlugin = function createPlugin() {
|
|
16
|
-
var syncClient = new _SyncClient.SyncClient();
|
|
14
|
+
var createPlugin = exports.createPlugin = function createPlugin(config, pmPluginFactoryParams) {
|
|
17
15
|
return new _safePlugin.SafePlugin({
|
|
18
16
|
key: syncedBlockPluginKey,
|
|
19
17
|
state: {
|
|
@@ -21,30 +19,20 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
21
19
|
return {};
|
|
22
20
|
},
|
|
23
21
|
apply: function apply(tr, currentPluginState) {
|
|
24
|
-
if (tr.docChanged) {
|
|
25
|
-
var $pos = tr.selection.$from;
|
|
26
|
-
var syncedBlockParent = (0, _utils.findSyncedBlockParent)($pos);
|
|
27
|
-
if (syncedBlockParent) {
|
|
28
|
-
var node = syncedBlockParent.node,
|
|
29
|
-
attributes = syncedBlockParent.attributes;
|
|
30
|
-
var _attributes$parameter = attributes.parameters,
|
|
31
|
-
sourceDocumentAri = _attributes$parameter.sourceDocumentAri,
|
|
32
|
-
contentAri = _attributes$parameter.contentAri,
|
|
33
|
-
contentPropertyKey = _attributes$parameter.contentPropertyKey;
|
|
34
|
-
syncClient.syncContent({
|
|
35
|
-
sourceDocumentAri: sourceDocumentAri,
|
|
36
|
-
contentAri: contentAri,
|
|
37
|
-
contentPropertyKey: contentPropertyKey,
|
|
38
|
-
node: node
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
22
|
var meta = tr.getMeta(syncedBlockPluginKey);
|
|
43
23
|
if (meta) {
|
|
44
24
|
return meta;
|
|
45
25
|
}
|
|
46
26
|
return currentPluginState;
|
|
47
27
|
}
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
nodeViews: {
|
|
31
|
+
syncBlock: (0, _lazySyncedBlock.lazySyncBlockView)({
|
|
32
|
+
config: config,
|
|
33
|
+
pmPluginFactoryParams: pmPluginFactoryParams
|
|
34
|
+
})
|
|
35
|
+
}
|
|
48
36
|
}
|
|
49
37
|
});
|
|
50
38
|
};
|
|
@@ -6,19 +6,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.syncedBlockPlugin = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
+
var _smartLink = _interopRequireDefault(require("@atlaskit/icon/core/smart-link"));
|
|
11
|
+
var _actions = require("./pm-plugins/actions");
|
|
9
12
|
var _main = require("./pm-plugins/main");
|
|
10
|
-
var
|
|
11
|
-
var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin() {
|
|
13
|
+
var _floatingToolbar = require("./ui/floating-toolbar");
|
|
14
|
+
var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_ref) {
|
|
15
|
+
var config = _ref.config;
|
|
12
16
|
return {
|
|
13
17
|
name: 'syncedBlock',
|
|
18
|
+
nodes: function nodes() {
|
|
19
|
+
return [{
|
|
20
|
+
name: 'syncBlock',
|
|
21
|
+
node: _adfSchema.syncBlock
|
|
22
|
+
}];
|
|
23
|
+
},
|
|
14
24
|
pmPlugins: function pmPlugins() {
|
|
15
25
|
return [{
|
|
16
26
|
name: 'syncedBlockPlugin',
|
|
17
|
-
plugin:
|
|
27
|
+
plugin: function plugin(params) {
|
|
28
|
+
return (0, _main.createPlugin)(config, params);
|
|
29
|
+
}
|
|
18
30
|
}];
|
|
19
31
|
},
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
pluginsOptions: {
|
|
33
|
+
quickInsert: function quickInsert() {
|
|
34
|
+
return [{
|
|
35
|
+
id: 'syncBlock',
|
|
36
|
+
title: 'Synced Block',
|
|
37
|
+
description: 'Create a synced block',
|
|
38
|
+
priority: 800,
|
|
39
|
+
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block'],
|
|
40
|
+
keyshortcut: '',
|
|
41
|
+
icon: function icon() {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_smartLink.default, {
|
|
43
|
+
label: "Synced Block"
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
action: function action(_insert, state) {
|
|
47
|
+
return (0, _actions.createSyncedBlock)(state);
|
|
48
|
+
}
|
|
49
|
+
}];
|
|
50
|
+
},
|
|
51
|
+
floatingToolbar: (0, _floatingToolbar.getToolbarConfig)()
|
|
22
52
|
}
|
|
23
53
|
};
|
|
24
54
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getToolbarConfig = void 0;
|
|
7
|
+
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
8
|
+
return function (_state, _intl) {
|
|
9
|
+
return undefined;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
+
export const lazySyncBlockView = props => {
|
|
3
|
+
return withLazyLoading({
|
|
4
|
+
nodeName: 'syncBlock',
|
|
5
|
+
getNodeViewOptions: () => {},
|
|
6
|
+
loader: () => {
|
|
7
|
+
const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-synced-block-nodeview" */
|
|
8
|
+
'./syncedBlock').then(({
|
|
9
|
+
syncBlockNodeView
|
|
10
|
+
}) => {
|
|
11
|
+
return syncBlockNodeView(props);
|
|
12
|
+
});
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
2
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
3
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
export const defaultSyncBlockDocument = {
|
|
5
|
+
version: 1,
|
|
6
|
+
type: 'doc',
|
|
7
|
+
content: [{
|
|
8
|
+
type: 'paragraph',
|
|
9
|
+
content: [{
|
|
10
|
+
type: 'text',
|
|
11
|
+
text: 'This is a synced block. Edit the source to update the content.'
|
|
12
|
+
}]
|
|
13
|
+
}]
|
|
14
|
+
};
|
|
15
|
+
const SyncBlockEditorWrapperDataId = 'sync-block-plugin-editor-wrapper';
|
|
16
|
+
export const SyncBlockPluginComponent = ({
|
|
17
|
+
config,
|
|
18
|
+
dom
|
|
19
|
+
}) => {
|
|
20
|
+
const innerEditorView = useRef(null);
|
|
21
|
+
|
|
22
|
+
/* Tmp solution to demonstrate the synced block renderer */
|
|
23
|
+
const [rendererDocument, setRendererDocument] = useState(defaultSyncBlockDocument);
|
|
24
|
+
const onChange = (editorView, _meta) => {
|
|
25
|
+
const content = editorView.state.doc.toJSON().content;
|
|
26
|
+
const rendererDocument = {
|
|
27
|
+
version: 1,
|
|
28
|
+
type: 'doc',
|
|
29
|
+
content
|
|
30
|
+
};
|
|
31
|
+
setRendererDocument(rendererDocument);
|
|
32
|
+
};
|
|
33
|
+
const onEditorReady = ({
|
|
34
|
+
editorView
|
|
35
|
+
}) => {
|
|
36
|
+
innerEditorView.current = editorView || null;
|
|
37
|
+
};
|
|
38
|
+
const boundariesElement = useMemo(() => {
|
|
39
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
40
|
+
return dom.closest('.fabric-editor-popup-scroll-parent');
|
|
41
|
+
}, [dom]);
|
|
42
|
+
if (!boundariesElement || !(boundariesElement instanceof HTMLElement)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (!(config !== null && config !== void 0 && config.getSyncedBlockEditor) || !(config !== null && config !== void 0 && config.getSyncedBlockRenderer)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
"data-testid": SyncBlockEditorWrapperDataId
|
|
50
|
+
}, config.getSyncedBlockEditor({
|
|
51
|
+
boundariesElement: boundariesElement,
|
|
52
|
+
defaultDocument: defaultSyncBlockDocument,
|
|
53
|
+
mountPoint: dom,
|
|
54
|
+
onChange: onChange,
|
|
55
|
+
onEditorReady: onEditorReady
|
|
56
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
style: {
|
|
58
|
+
width: '100%',
|
|
59
|
+
height: '1px',
|
|
60
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
61
|
+
backgroundColor: 'purple'
|
|
62
|
+
}
|
|
63
|
+
}), config.getSyncedBlockRenderer({
|
|
64
|
+
docNode: rendererDocument
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
class SyncBlock extends ReactNodeView {
|
|
68
|
+
createDomRef() {
|
|
69
|
+
const domRef = document.createElement('div');
|
|
70
|
+
domRef.setAttribute('style', 'border: purple solid 1px;');
|
|
71
|
+
return domRef;
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return /*#__PURE__*/React.createElement(SyncBlockPluginComponent, {
|
|
75
|
+
config: this.reactComponentProps.config,
|
|
76
|
+
dom: this.dom
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
stopEvent(event) {
|
|
80
|
+
var _target$closest;
|
|
81
|
+
const target = event.target;
|
|
82
|
+
if (!target) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return ((_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, `[data-testid="${SyncBlockEditorWrapperDataId}"]`)) != null;
|
|
86
|
+
}
|
|
87
|
+
destroy() {
|
|
88
|
+
var _this$unsubscribe;
|
|
89
|
+
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
|
|
90
|
+
super.destroy();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export const syncBlockNodeView = ({
|
|
94
|
+
config,
|
|
95
|
+
pmPluginFactoryParams
|
|
96
|
+
}) => (node, view, getPos) => {
|
|
97
|
+
const {
|
|
98
|
+
portalProviderAPI,
|
|
99
|
+
eventDispatcher
|
|
100
|
+
} = pmPluginFactoryParams;
|
|
101
|
+
const reactComponentProps = {
|
|
102
|
+
config
|
|
103
|
+
};
|
|
104
|
+
return new SyncBlock(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
|
|
105
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
const getRandomId = () => {
|
|
3
|
+
if (!globalThis.crypto || typeof globalThis.crypto.randomUUID !== 'function') {
|
|
4
|
+
return new Date().toISOString();
|
|
5
|
+
}
|
|
6
|
+
return globalThis.crypto.randomUUID();
|
|
7
|
+
};
|
|
8
|
+
export const createSyncedBlock = state => {
|
|
9
|
+
const tr = state.tr;
|
|
10
|
+
// const { breakout } = state.schema.marks;
|
|
11
|
+
const node = state.schema.nodes.syncBlock.createChecked({
|
|
12
|
+
resourceId: getRandomId(),
|
|
13
|
+
localId: getRandomId()
|
|
14
|
+
}, null
|
|
15
|
+
// [breakout.create({ mode: 'wide' })],
|
|
16
|
+
);
|
|
17
|
+
safeInsert(node)(tr);
|
|
18
|
+
return tr;
|
|
19
|
+
};
|