@atlaskit/editor-plugin-synced-block 3.7.0 → 3.7.2
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 +14 -0
- package/dist/cjs/pm-plugins/main.js +15 -0
- package/dist/es2019/pm-plugins/main.js +15 -0
- package/dist/esm/pm-plugins/main.js +15 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 3.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.7.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`cdf397d4529c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cdf397d4529c6) -
|
|
14
|
+
EDITOR-2443 Temporary fix for inserting 'random' node into sync block on enter
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.7.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -9,10 +9,14 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
9
9
|
var _bodiedLazySyncedBlock = require("../nodeviews/bodiedLazySyncedBlock");
|
|
10
10
|
var _lazySyncedBlock = require("../nodeviews/lazySyncedBlock");
|
|
11
11
|
var _trackSyncBlocks2 = require("./utils/track-sync-blocks");
|
|
12
|
+
var _utils = require("./utils/utils");
|
|
12
13
|
var syncedBlockPluginKey = exports.syncedBlockPluginKey = new _state.PluginKey('syncedBlockPlugin');
|
|
13
14
|
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
15
16
|
|
|
17
|
+
function isInsideBodiedSyncBlock(state, selection) {
|
|
18
|
+
return (0, _utils.findBodiedSyncBlock)(state, selection) !== undefined;
|
|
19
|
+
}
|
|
16
20
|
var createPlugin = exports.createPlugin = function createPlugin(options, pmPluginFactoryParams, syncBlockStore, api) {
|
|
17
21
|
return new _safePlugin.SafePlugin({
|
|
18
22
|
key: syncedBlockPluginKey,
|
|
@@ -42,6 +46,17 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
42
46
|
api: api,
|
|
43
47
|
syncBlockStore: syncBlockStore
|
|
44
48
|
})
|
|
49
|
+
},
|
|
50
|
+
handleKeyDown: function handleKeyDown(view, event) {
|
|
51
|
+
if (event.key === 'Enter' && isInsideBodiedSyncBlock(view.state, view.state.selection)) {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
// Insert a new paragraph instead of letting browser handle it
|
|
54
|
+
var tr = view.state.tr;
|
|
55
|
+
tr.split(view.state.selection.from);
|
|
56
|
+
view.dispatch(tr);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
45
60
|
}
|
|
46
61
|
},
|
|
47
62
|
view: function view(editorView) {
|
|
@@ -3,10 +3,14 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { lazyBodiedSyncBlockView } from '../nodeviews/bodiedLazySyncedBlock';
|
|
4
4
|
import { lazySyncBlockView } from '../nodeviews/lazySyncedBlock';
|
|
5
5
|
import { trackSyncBlocks } from './utils/track-sync-blocks';
|
|
6
|
+
import { findBodiedSyncBlock } from './utils/utils';
|
|
6
7
|
export const syncedBlockPluginKey = new PluginKey('syncedBlockPlugin');
|
|
7
8
|
|
|
8
9
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
9
10
|
|
|
11
|
+
function isInsideBodiedSyncBlock(state, selection) {
|
|
12
|
+
return findBodiedSyncBlock(state, selection) !== undefined;
|
|
13
|
+
}
|
|
10
14
|
export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api) => {
|
|
11
15
|
return new SafePlugin({
|
|
12
16
|
key: syncedBlockPluginKey,
|
|
@@ -36,6 +40,17 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
36
40
|
api,
|
|
37
41
|
syncBlockStore
|
|
38
42
|
})
|
|
43
|
+
},
|
|
44
|
+
handleKeyDown: (view, event) => {
|
|
45
|
+
if (event.key === 'Enter' && isInsideBodiedSyncBlock(view.state, view.state.selection)) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
// Insert a new paragraph instead of letting browser handle it
|
|
48
|
+
const tr = view.state.tr;
|
|
49
|
+
tr.split(view.state.selection.from);
|
|
50
|
+
view.dispatch(tr);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
39
54
|
}
|
|
40
55
|
},
|
|
41
56
|
view: editorView => {
|
|
@@ -3,10 +3,14 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { lazyBodiedSyncBlockView } from '../nodeviews/bodiedLazySyncedBlock';
|
|
4
4
|
import { lazySyncBlockView } from '../nodeviews/lazySyncedBlock';
|
|
5
5
|
import { trackSyncBlocks } from './utils/track-sync-blocks';
|
|
6
|
+
import { findBodiedSyncBlock } from './utils/utils';
|
|
6
7
|
export var syncedBlockPluginKey = new PluginKey('syncedBlockPlugin');
|
|
7
8
|
|
|
8
9
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
9
10
|
|
|
11
|
+
function isInsideBodiedSyncBlock(state, selection) {
|
|
12
|
+
return findBodiedSyncBlock(state, selection) !== undefined;
|
|
13
|
+
}
|
|
10
14
|
export var createPlugin = function createPlugin(options, pmPluginFactoryParams, syncBlockStore, api) {
|
|
11
15
|
return new SafePlugin({
|
|
12
16
|
key: syncedBlockPluginKey,
|
|
@@ -36,6 +40,17 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
36
40
|
api: api,
|
|
37
41
|
syncBlockStore: syncBlockStore
|
|
38
42
|
})
|
|
43
|
+
},
|
|
44
|
+
handleKeyDown: function handleKeyDown(view, event) {
|
|
45
|
+
if (event.key === 'Enter' && isInsideBodiedSyncBlock(view.state, view.state.selection)) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
// Insert a new paragraph instead of letting browser handle it
|
|
48
|
+
var tr = view.state.tr;
|
|
49
|
+
tr.split(view.state.selection.from);
|
|
50
|
+
view.dispatch(tr);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
39
54
|
}
|
|
40
55
|
},
|
|
41
56
|
view: function view(editorView) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.8.0",
|
|
41
41
|
"@atlaskit/editor-synced-block-provider": "^2.0.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
43
|
+
"@atlaskit/editor-toolbar": "^0.16.0",
|
|
44
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.16.0",
|
|
51
51
|
"react": "^18.2.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|