@atlaskit/editor-plugin-block-type 4.0.2 → 4.0.4
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 +18 -0
- package/consts/package.json +5 -5
- package/dist/cjs/{plugin/index.js → blockTypePlugin.js} +27 -3
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{plugin/pm-plugins → pm-plugins}/input-rule.js +1 -1
- package/dist/cjs/{plugin/pm-plugins → pm-plugins}/keymap.js +3 -3
- package/dist/cjs/{plugin/pm-plugins → pm-plugins}/main.js +4 -4
- package/dist/cjs/pm-plugins/types.js +5 -0
- package/dist/cjs/pm-plugins/ui/FloatingToolbarComponent.js +44 -0
- package/dist/cjs/{consts.js → ui/consts.js} +1 -1
- package/dist/es2019/{plugin/index.js → blockTypePlugin.js} +27 -3
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/{plugin/pm-plugins → pm-plugins}/input-rule.js +1 -1
- package/dist/es2019/{plugin/pm-plugins → pm-plugins}/keymap.js +3 -3
- package/dist/es2019/{plugin/pm-plugins → pm-plugins}/main.js +4 -4
- package/dist/es2019/pm-plugins/ui/FloatingToolbarComponent.js +36 -0
- package/dist/{esm → es2019/ui}/consts.js +1 -1
- package/dist/esm/{plugin/index.js → blockTypePlugin.js} +27 -3
- package/dist/esm/blockTypePluginType.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/{plugin/pm-plugins → pm-plugins}/input-rule.js +1 -1
- package/dist/esm/{plugin/pm-plugins → pm-plugins}/keymap.js +3 -3
- package/dist/esm/{plugin/pm-plugins → pm-plugins}/main.js +4 -4
- package/dist/esm/pm-plugins/types.js +1 -0
- package/dist/esm/pm-plugins/ui/FloatingToolbarComponent.js +34 -0
- package/dist/{es2019 → esm/ui}/consts.js +1 -1
- package/dist/types/blockTypePlugin.d.ts +5 -0
- package/dist/types/{plugin/index.d.ts → blockTypePluginType.d.ts} +3 -7
- package/dist/types/index.d.ts +7 -7
- package/dist/types/{plugin/pm-plugins → pm-plugins}/main.d.ts +2 -2
- package/dist/types/pm-plugins/ui/FloatingToolbarComponent.d.ts +8 -0
- package/dist/types/{plugin → pm-plugins}/ui/PrimaryToolbarComponent.d.ts +1 -1
- package/dist/types/{plugin → pm-plugins}/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types/{consts.d.ts → ui/consts.d.ts} +1 -1
- package/dist/types-ts4.5/blockTypePlugin.d.ts +5 -0
- package/dist/types-ts4.5/{plugin/index.d.ts → blockTypePluginType.d.ts} +3 -7
- package/dist/types-ts4.5/index.d.ts +7 -7
- package/dist/types-ts4.5/{plugin/pm-plugins → pm-plugins}/main.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/ui/FloatingToolbarComponent.d.ts +8 -0
- package/dist/types-ts4.5/{plugin → pm-plugins}/ui/PrimaryToolbarComponent.d.ts +1 -1
- package/dist/types-ts4.5/{plugin → pm-plugins}/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types-ts4.5/{consts.d.ts → ui/consts.d.ts} +1 -1
- package/package.json +12 -9
- package/styles/package.json +5 -5
- package/dist/cjs/i18n/cs.js +0 -47
- package/dist/cjs/i18n/da.js +0 -47
- package/dist/cjs/i18n/de.js +0 -47
- package/dist/cjs/i18n/en.js +0 -47
- package/dist/cjs/i18n/en_GB.js +0 -47
- package/dist/cjs/i18n/en_ZZ.js +0 -47
- package/dist/cjs/i18n/es.js +0 -47
- package/dist/cjs/i18n/fi.js +0 -47
- package/dist/cjs/i18n/fr.js +0 -47
- package/dist/cjs/i18n/hu.js +0 -47
- package/dist/cjs/i18n/it.js +0 -47
- package/dist/cjs/i18n/ja.js +0 -47
- package/dist/cjs/i18n/ko.js +0 -47
- package/dist/cjs/i18n/nb.js +0 -47
- package/dist/cjs/i18n/nl.js +0 -47
- package/dist/cjs/i18n/pl.js +0 -47
- package/dist/cjs/i18n/pt_BR.js +0 -47
- package/dist/cjs/i18n/ru.js +0 -47
- package/dist/cjs/i18n/sv.js +0 -47
- package/dist/cjs/i18n/th.js +0 -47
- package/dist/cjs/i18n/tr.js +0 -47
- package/dist/cjs/i18n/uk.js +0 -47
- package/dist/cjs/i18n/vi.js +0 -47
- package/dist/cjs/i18n/zh.js +0 -47
- package/dist/cjs/i18n/zh_TW.js +0 -47
- package/dist/cjs/styles.js +0 -12
- package/dist/es2019/i18n/cs.js +0 -41
- package/dist/es2019/i18n/da.js +0 -41
- package/dist/es2019/i18n/de.js +0 -41
- package/dist/es2019/i18n/en.js +0 -41
- package/dist/es2019/i18n/en_GB.js +0 -41
- package/dist/es2019/i18n/en_ZZ.js +0 -41
- package/dist/es2019/i18n/es.js +0 -41
- package/dist/es2019/i18n/fi.js +0 -41
- package/dist/es2019/i18n/fr.js +0 -41
- package/dist/es2019/i18n/hu.js +0 -41
- package/dist/es2019/i18n/it.js +0 -41
- package/dist/es2019/i18n/ja.js +0 -41
- package/dist/es2019/i18n/ko.js +0 -41
- package/dist/es2019/i18n/nb.js +0 -41
- package/dist/es2019/i18n/nl.js +0 -41
- package/dist/es2019/i18n/pl.js +0 -41
- package/dist/es2019/i18n/pt_BR.js +0 -41
- package/dist/es2019/i18n/ru.js +0 -41
- package/dist/es2019/i18n/sv.js +0 -41
- package/dist/es2019/i18n/th.js +0 -41
- package/dist/es2019/i18n/tr.js +0 -41
- package/dist/es2019/i18n/uk.js +0 -41
- package/dist/es2019/i18n/vi.js +0 -41
- package/dist/es2019/i18n/zh.js +0 -41
- package/dist/es2019/i18n/zh_TW.js +0 -41
- package/dist/es2019/styles.js +0 -1
- package/dist/esm/i18n/cs.js +0 -41
- package/dist/esm/i18n/da.js +0 -41
- package/dist/esm/i18n/de.js +0 -41
- package/dist/esm/i18n/en.js +0 -41
- package/dist/esm/i18n/en_GB.js +0 -41
- package/dist/esm/i18n/en_ZZ.js +0 -41
- package/dist/esm/i18n/es.js +0 -41
- package/dist/esm/i18n/fi.js +0 -41
- package/dist/esm/i18n/fr.js +0 -41
- package/dist/esm/i18n/hu.js +0 -41
- package/dist/esm/i18n/it.js +0 -41
- package/dist/esm/i18n/ja.js +0 -41
- package/dist/esm/i18n/ko.js +0 -41
- package/dist/esm/i18n/nb.js +0 -41
- package/dist/esm/i18n/nl.js +0 -41
- package/dist/esm/i18n/pl.js +0 -41
- package/dist/esm/i18n/pt_BR.js +0 -41
- package/dist/esm/i18n/ru.js +0 -41
- package/dist/esm/i18n/sv.js +0 -41
- package/dist/esm/i18n/th.js +0 -41
- package/dist/esm/i18n/tr.js +0 -41
- package/dist/esm/i18n/uk.js +0 -41
- package/dist/esm/i18n/vi.js +0 -41
- package/dist/esm/i18n/zh.js +0 -41
- package/dist/esm/i18n/zh_TW.js +0 -41
- package/dist/esm/styles.js +0 -1
- package/dist/types/i18n/cs.d.ts +0 -40
- package/dist/types/i18n/da.d.ts +0 -40
- package/dist/types/i18n/de.d.ts +0 -40
- package/dist/types/i18n/en.d.ts +0 -40
- package/dist/types/i18n/en_GB.d.ts +0 -40
- package/dist/types/i18n/en_ZZ.d.ts +0 -40
- package/dist/types/i18n/es.d.ts +0 -40
- package/dist/types/i18n/fi.d.ts +0 -40
- package/dist/types/i18n/fr.d.ts +0 -40
- package/dist/types/i18n/hu.d.ts +0 -40
- package/dist/types/i18n/it.d.ts +0 -40
- package/dist/types/i18n/ja.d.ts +0 -40
- package/dist/types/i18n/ko.d.ts +0 -40
- package/dist/types/i18n/nb.d.ts +0 -40
- package/dist/types/i18n/nl.d.ts +0 -40
- package/dist/types/i18n/pl.d.ts +0 -40
- package/dist/types/i18n/pt_BR.d.ts +0 -40
- package/dist/types/i18n/ru.d.ts +0 -40
- package/dist/types/i18n/sv.d.ts +0 -40
- package/dist/types/i18n/th.d.ts +0 -40
- package/dist/types/i18n/tr.d.ts +0 -40
- package/dist/types/i18n/uk.d.ts +0 -40
- package/dist/types/i18n/vi.d.ts +0 -40
- package/dist/types/i18n/zh.d.ts +0 -40
- package/dist/types/i18n/zh_TW.d.ts +0 -40
- package/dist/types/styles.d.ts +0 -1
- package/dist/types-ts4.5/i18n/cs.d.ts +0 -40
- package/dist/types-ts4.5/i18n/da.d.ts +0 -40
- package/dist/types-ts4.5/i18n/de.d.ts +0 -40
- package/dist/types-ts4.5/i18n/en.d.ts +0 -40
- package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -40
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -40
- package/dist/types-ts4.5/i18n/es.d.ts +0 -40
- package/dist/types-ts4.5/i18n/fi.d.ts +0 -40
- package/dist/types-ts4.5/i18n/fr.d.ts +0 -40
- package/dist/types-ts4.5/i18n/hu.d.ts +0 -40
- package/dist/types-ts4.5/i18n/it.d.ts +0 -40
- package/dist/types-ts4.5/i18n/ja.d.ts +0 -40
- package/dist/types-ts4.5/i18n/ko.d.ts +0 -40
- package/dist/types-ts4.5/i18n/nb.d.ts +0 -40
- package/dist/types-ts4.5/i18n/nl.d.ts +0 -40
- package/dist/types-ts4.5/i18n/pl.d.ts +0 -40
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -40
- package/dist/types-ts4.5/i18n/ru.d.ts +0 -40
- package/dist/types-ts4.5/i18n/sv.d.ts +0 -40
- package/dist/types-ts4.5/i18n/th.d.ts +0 -40
- package/dist/types-ts4.5/i18n/tr.d.ts +0 -40
- package/dist/types-ts4.5/i18n/uk.d.ts +0 -40
- package/dist/types-ts4.5/i18n/vi.d.ts +0 -40
- package/dist/types-ts4.5/i18n/zh.d.ts +0 -40
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -40
- package/dist/types-ts4.5/styles.d.ts +0 -1
- /package/dist/cjs/{plugin/types.js → blockTypePluginType.js} +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/block-types.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/commands/block-type.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/commands/delete-and-move-cursor.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/commands/delete-block-content.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/commands/index.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/consts.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/ui/PrimaryToolbarComponent.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/ui/ToolbarBlockType/blocktype-button.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/ui/ToolbarBlockType/index.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/ui/ToolbarBlockType/styled.js +0 -0
- /package/dist/cjs/{plugin → pm-plugins}/utils.js +0 -0
- /package/dist/cjs/{plugin → ui}/styles.js +0 -0
- /package/dist/es2019/{plugin/types.js → blockTypePluginType.js} +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/block-types.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/commands/block-type.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/commands/delete-and-move-cursor.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/commands/delete-block-content.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/commands/index.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/consts.js +0 -0
- /package/dist/{esm/plugin → es2019/pm-plugins}/types.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/ui/PrimaryToolbarComponent.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/ui/ToolbarBlockType/blocktype-button.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/ui/ToolbarBlockType/index.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/ui/ToolbarBlockType/styled.js +0 -0
- /package/dist/es2019/{plugin → pm-plugins}/utils.js +0 -0
- /package/dist/es2019/{plugin → ui}/styles.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/block-types.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/commands/block-type.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/commands/delete-and-move-cursor.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/commands/delete-block-content.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/commands/index.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/consts.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/ui/PrimaryToolbarComponent.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/ui/ToolbarBlockType/blocktype-button.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/ui/ToolbarBlockType/index.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/ui/ToolbarBlockType/styled.js +0 -0
- /package/dist/esm/{plugin → pm-plugins}/utils.js +0 -0
- /package/dist/esm/{plugin → ui}/styles.js +0 -0
- /package/dist/types/{plugin → pm-plugins}/block-types.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/commands/block-type.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/commands/delete-and-move-cursor.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/commands/delete-block-content.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/commands/index.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/consts.d.ts +0 -0
- /package/dist/types/{plugin/pm-plugins → pm-plugins}/input-rule.d.ts +0 -0
- /package/dist/types/{plugin/pm-plugins → pm-plugins}/keymap.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/types.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/ui/ToolbarBlockType/blocktype-button.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/ui/ToolbarBlockType/styled.d.ts +0 -0
- /package/dist/types/{plugin → pm-plugins}/utils.d.ts +0 -0
- /package/dist/types/{plugin → ui}/styles.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/block-types.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/commands/block-type.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/commands/delete-and-move-cursor.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/commands/delete-block-content.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/commands/index.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/consts.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin/pm-plugins → pm-plugins}/input-rule.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin/pm-plugins → pm-plugins}/keymap.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/types.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/ui/ToolbarBlockType/blocktype-button.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/ui/ToolbarBlockType/styled.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → pm-plugins}/utils.d.ts +0 -0
- /package/dist/types-ts4.5/{plugin → ui}/styles.d.ts +0 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
2
2
|
|
3
|
+
## 4.0.4
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#165097](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165097)
|
8
|
+
[`0bca145c96b65`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0bca145c96b65) -
|
9
|
+
[ux] Adds test styles options to the Selection toolbar under Contextual toolbar experiment
|
10
|
+
- Updated dependencies
|
11
|
+
|
12
|
+
## 4.0.3
|
13
|
+
|
14
|
+
### Patch Changes
|
15
|
+
|
16
|
+
- [#159777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159777)
|
17
|
+
[`e708d0a9e4b36`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e708d0a9e4b36) -
|
18
|
+
Refactoring plugins to meet folder standards.
|
19
|
+
- Updated dependencies
|
20
|
+
|
3
21
|
## 4.0.2
|
4
22
|
|
5
23
|
### Patch Changes
|
package/consts/package.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type/consts",
|
3
|
-
"main": "../dist/cjs/consts.js",
|
4
|
-
"module": "../dist/esm/consts.js",
|
5
|
-
"module:es2019": "../dist/es2019/consts.js",
|
3
|
+
"main": "../dist/cjs/ui/consts.js",
|
4
|
+
"module": "../dist/esm/ui/consts.js",
|
5
|
+
"module:es2019": "../dist/es2019/ui/consts.js",
|
6
6
|
"sideEffects": false,
|
7
|
-
"types": "../dist/types/consts.d.ts",
|
7
|
+
"types": "../dist/types/ui/consts.d.ts",
|
8
8
|
"typesVersions": {
|
9
9
|
">=4.5 <5.4": {
|
10
10
|
"*": [
|
11
|
-
"../dist/types-ts4.5/consts.d.ts"
|
11
|
+
"../dist/types-ts4.5/ui/consts.d.ts"
|
12
12
|
]
|
13
13
|
}
|
14
14
|
}
|
@@ -20,12 +20,14 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
20
20
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
21
21
|
var _types = require("@atlaskit/editor-common/types");
|
22
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
23
|
-
var
|
24
|
-
var
|
23
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
24
|
+
var _commands = require("./pm-plugins/commands");
|
25
|
+
var _blockType = require("./pm-plugins/commands/block-type");
|
25
26
|
var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
26
27
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
27
28
|
var _main = require("./pm-plugins/main");
|
28
|
-
var
|
29
|
+
var _FloatingToolbarComponent = require("./pm-plugins/ui/FloatingToolbarComponent");
|
30
|
+
var _PrimaryToolbarComponent = require("./pm-plugins/ui/PrimaryToolbarComponent");
|
29
31
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
30
32
|
var formatMessage = _ref.formatMessage;
|
31
33
|
if (!isAllowed) {
|
@@ -201,6 +203,28 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
201
203
|
},
|
202
204
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
203
205
|
pluginsOptions: {
|
206
|
+
selectionToolbar: function selectionToolbar() {
|
207
|
+
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true)) {
|
208
|
+
var toolbarCustom = {
|
209
|
+
type: 'custom',
|
210
|
+
render: function render(view, _idx, _dispatchAnalyticsEvent) {
|
211
|
+
if (!view) {
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
return /*#__PURE__*/_react.default.createElement(_FloatingToolbarComponent.FloatingToolbarComponent, {
|
215
|
+
api: api
|
216
|
+
});
|
217
|
+
},
|
218
|
+
fallback: []
|
219
|
+
};
|
220
|
+
return {
|
221
|
+
isToolbarAbove: true,
|
222
|
+
items: [toolbarCustom]
|
223
|
+
};
|
224
|
+
} else {
|
225
|
+
return undefined;
|
226
|
+
}
|
227
|
+
},
|
204
228
|
quickInsert: function quickInsert(intl) {
|
205
229
|
var _api$analytics5, _api$analytics6;
|
206
230
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
package/dist/cjs/index.js
CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
Object.defineProperty(exports, "blockTypePlugin", {
|
7
7
|
enumerable: true,
|
8
8
|
get: function get() {
|
9
|
-
return
|
9
|
+
return _blockTypePlugin.blockTypePlugin;
|
10
10
|
}
|
11
11
|
});
|
12
|
-
var
|
12
|
+
var _blockTypePlugin = require("./blockTypePlugin");
|
@@ -11,7 +11,7 @@ var _commands = require("@atlaskit/editor-common/commands");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
13
13
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
14
|
-
var _utils2 = require("
|
14
|
+
var _utils2 = require("./utils");
|
15
15
|
var MAX_HEADING_LEVEL = 6;
|
16
16
|
function getHeadingLevel(match) {
|
17
17
|
return {
|
@@ -10,9 +10,9 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
11
11
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
12
12
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
13
|
-
var blockTypes = _interopRequireWildcard(require("
|
14
|
-
var _commands2 = require("
|
15
|
-
var _utils2 = require("
|
13
|
+
var blockTypes = _interopRequireWildcard(require("./block-types"));
|
14
|
+
var _commands2 = require("./commands");
|
15
|
+
var _utils2 = require("./utils");
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
18
18
|
var backspaceCommand = (0, _commands.chainCommands)(_commands2.cleanUpAtTheStartOfDocument, (0, _commands2.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _commands2.deleteAndMoveCursor);
|
@@ -11,10 +11,10 @@ var _browser = require("@atlaskit/editor-common/browser");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
13
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
14
|
-
var _blockTypes = require("
|
15
|
-
var _commands = require("
|
16
|
-
var _consts = require("
|
17
|
-
var _utils = require("
|
14
|
+
var _blockTypes = require("./block-types");
|
15
|
+
var _commands = require("./commands");
|
16
|
+
var _consts = require("./consts");
|
17
|
+
var _utils = require("./utils");
|
18
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
19
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
20
20
|
var blockTypeForNode = function blockTypeForNode(node, schema) {
|
@@ -0,0 +1,44 @@
|
|
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.FloatingToolbarComponent = FloatingToolbarComponent;
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
11
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
13
|
+
var _ToolbarBlockType = _interopRequireDefault(require("./ToolbarBlockType"));
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
16
|
+
var FloatingToolbarSettings = {
|
17
|
+
isSmall: true,
|
18
|
+
disabled: false,
|
19
|
+
isToolbarReducedSpacing: true,
|
20
|
+
shouldUseDefaultRole: false
|
21
|
+
};
|
22
|
+
function FloatingToolbarComponent(_ref) {
|
23
|
+
var api = _ref.api;
|
24
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['blockType']),
|
25
|
+
blockTypeState = _useSharedPluginState.blockTypeState;
|
26
|
+
(0, _react.useEffect)(function () {
|
27
|
+
(0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
|
28
|
+
exposure: true
|
29
|
+
});
|
30
|
+
}, []);
|
31
|
+
var boundSetBlockType = (0, _react.useCallback)(function (name) {
|
32
|
+
var _api$core, _api$blockType;
|
33
|
+
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, _analytics.INPUT_METHOD.FLOATING_TB));
|
34
|
+
}, [api]);
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_ToolbarBlockType.default, {
|
36
|
+
isSmall: FloatingToolbarSettings.isSmall,
|
37
|
+
isDisabled: FloatingToolbarSettings.disabled,
|
38
|
+
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
39
|
+
setTextLevel: boundSetBlockType,
|
40
|
+
pluginState: blockTypeState,
|
41
|
+
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
42
|
+
api: api
|
43
|
+
});
|
44
|
+
}
|
@@ -6,12 +6,14 @@ import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages'
|
|
6
6
|
import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
|
7
7
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
9
|
-
import {
|
10
|
-
import {
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
10
|
+
import { setBlockTypeWithAnalytics } from './pm-plugins/commands';
|
11
|
+
import { insertBlockQuoteWithAnalytics } from './pm-plugins/commands/block-type';
|
11
12
|
import inputRulePlugin from './pm-plugins/input-rule';
|
12
13
|
import keymapPlugin from './pm-plugins/keymap';
|
13
14
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
14
|
-
import {
|
15
|
+
import { FloatingToolbarComponent } from './pm-plugins/ui/FloatingToolbarComponent';
|
16
|
+
import { PrimaryToolbarComponent } from './pm-plugins/ui/PrimaryToolbarComponent';
|
15
17
|
const headingPluginOptions = ({
|
16
18
|
formatMessage
|
17
19
|
}, isAllowed, editorAnalyticsApi) => {
|
@@ -186,6 +188,28 @@ const blockTypePlugin = ({
|
|
186
188
|
},
|
187
189
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
188
190
|
pluginsOptions: {
|
191
|
+
selectionToolbar: () => {
|
192
|
+
if (editorExperiment('contextual_formatting_toolbar', true)) {
|
193
|
+
const toolbarCustom = {
|
194
|
+
type: 'custom',
|
195
|
+
render: (view, _idx, _dispatchAnalyticsEvent) => {
|
196
|
+
if (!view) {
|
197
|
+
return;
|
198
|
+
}
|
199
|
+
return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
|
200
|
+
api: api
|
201
|
+
});
|
202
|
+
},
|
203
|
+
fallback: []
|
204
|
+
};
|
205
|
+
return {
|
206
|
+
isToolbarAbove: true,
|
207
|
+
items: [toolbarCustom]
|
208
|
+
};
|
209
|
+
} else {
|
210
|
+
return undefined;
|
211
|
+
}
|
212
|
+
},
|
189
213
|
quickInsert: intl => {
|
190
214
|
var _api$analytics5, _api$analytics6;
|
191
215
|
const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
package/dist/es2019/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { blockTypePlugin } from './
|
1
|
+
export { blockTypePlugin } from './blockTypePlugin';
|
@@ -3,7 +3,7 @@ import { insertBlock } from '@atlaskit/editor-common/commands';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
4
4
|
import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
|
5
5
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
6
|
-
import { createJoinNodesRule, createWrappingTextBlockRule } from '
|
6
|
+
import { createJoinNodesRule, createWrappingTextBlockRule } from './utils';
|
7
7
|
const MAX_HEADING_LEVEL = 6;
|
8
8
|
function getHeadingLevel(match) {
|
9
9
|
return {
|
@@ -3,9 +3,9 @@ import { backspace, bindKeymapWithCommand, deleteKey, findKeyMapForBrowser, find
|
|
3
3
|
import { createNewParagraphAbove, createNewParagraphBelow, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics } from '@atlaskit/editor-common/utils';
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
5
5
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
6
|
-
import * as blockTypes from '
|
7
|
-
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockQuoteWithAnalytics } from '
|
8
|
-
import { isNodeAWrappingBlockNode } from '
|
6
|
+
import * as blockTypes from './block-types';
|
7
|
+
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockQuoteWithAnalytics } from './commands';
|
8
|
+
import { isNodeAWrappingBlockNode } from './utils';
|
9
9
|
const backspaceCommand = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
10
10
|
const del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
11
11
|
export default function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
@@ -3,10 +3,10 @@ import { browser } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
5
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
6
|
-
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES } from '
|
7
|
-
import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from '
|
8
|
-
import { HEADING_KEYS } from '
|
9
|
-
import { areBlockTypesDisabled } from '
|
6
|
+
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES } from './block-types';
|
7
|
+
import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands';
|
8
|
+
import { HEADING_KEYS } from './consts';
|
9
|
+
import { areBlockTypesDisabled } from './utils';
|
10
10
|
const blockTypeForNode = (node, schema) => {
|
11
11
|
if (node.type === schema.nodes.heading) {
|
12
12
|
const maybeNode = HEADINGS_BY_LEVEL[node.attrs['level']];
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
5
|
+
import ToolbarBlockType from './ToolbarBlockType';
|
6
|
+
const FloatingToolbarSettings = {
|
7
|
+
isSmall: true,
|
8
|
+
disabled: false,
|
9
|
+
isToolbarReducedSpacing: true,
|
10
|
+
shouldUseDefaultRole: false
|
11
|
+
};
|
12
|
+
export function FloatingToolbarComponent({
|
13
|
+
api
|
14
|
+
}) {
|
15
|
+
const {
|
16
|
+
blockTypeState
|
17
|
+
} = useSharedPluginState(api, ['blockType']);
|
18
|
+
useEffect(() => {
|
19
|
+
editorExperiment('contextual_formatting_toolbar', true, {
|
20
|
+
exposure: true
|
21
|
+
});
|
22
|
+
}, []);
|
23
|
+
const boundSetBlockType = useCallback(name => {
|
24
|
+
var _api$core, _api$blockType, _api$blockType$comman;
|
25
|
+
return api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : (_api$blockType$comman = _api$blockType.commands) === null || _api$blockType$comman === void 0 ? void 0 : _api$blockType$comman.setTextLevel(name, INPUT_METHOD.FLOATING_TB));
|
26
|
+
}, [api]);
|
27
|
+
return /*#__PURE__*/React.createElement(ToolbarBlockType, {
|
28
|
+
isSmall: FloatingToolbarSettings.isSmall,
|
29
|
+
isDisabled: FloatingToolbarSettings.disabled,
|
30
|
+
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
31
|
+
setTextLevel: boundSetBlockType,
|
32
|
+
pluginState: blockTypeState,
|
33
|
+
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
34
|
+
api: api
|
35
|
+
});
|
36
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, NORMAL_TEXT, PANEL } from '
|
1
|
+
export { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, NORMAL_TEXT, PANEL } from '../pm-plugins/block-types';
|
@@ -7,12 +7,14 @@ import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages'
|
|
7
7
|
import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
|
8
8
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
10
|
-
import {
|
11
|
-
import {
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
11
|
+
import { setBlockTypeWithAnalytics } from './pm-plugins/commands';
|
12
|
+
import { insertBlockQuoteWithAnalytics } from './pm-plugins/commands/block-type';
|
12
13
|
import inputRulePlugin from './pm-plugins/input-rule';
|
13
14
|
import keymapPlugin from './pm-plugins/keymap';
|
14
15
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
15
|
-
import {
|
16
|
+
import { FloatingToolbarComponent } from './pm-plugins/ui/FloatingToolbarComponent';
|
17
|
+
import { PrimaryToolbarComponent } from './pm-plugins/ui/PrimaryToolbarComponent';
|
16
18
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
17
19
|
var formatMessage = _ref.formatMessage;
|
18
20
|
if (!isAllowed) {
|
@@ -188,6 +190,28 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
188
190
|
},
|
189
191
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
190
192
|
pluginsOptions: {
|
193
|
+
selectionToolbar: function selectionToolbar() {
|
194
|
+
if (editorExperiment('contextual_formatting_toolbar', true)) {
|
195
|
+
var toolbarCustom = {
|
196
|
+
type: 'custom',
|
197
|
+
render: function render(view, _idx, _dispatchAnalyticsEvent) {
|
198
|
+
if (!view) {
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
|
202
|
+
api: api
|
203
|
+
});
|
204
|
+
},
|
205
|
+
fallback: []
|
206
|
+
};
|
207
|
+
return {
|
208
|
+
isToolbarAbove: true,
|
209
|
+
items: [toolbarCustom]
|
210
|
+
};
|
211
|
+
} else {
|
212
|
+
return undefined;
|
213
|
+
}
|
214
|
+
},
|
191
215
|
quickInsert: function quickInsert(intl) {
|
192
216
|
var _api$analytics5, _api$analytics6;
|
193
217
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/esm/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { blockTypePlugin } from './
|
1
|
+
export { blockTypePlugin } from './blockTypePlugin';
|
@@ -4,7 +4,7 @@ import { insertBlock } from '@atlaskit/editor-common/commands';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
5
5
|
import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
|
6
6
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
7
|
-
import { createJoinNodesRule, createWrappingTextBlockRule } from '
|
7
|
+
import { createJoinNodesRule, createWrappingTextBlockRule } from './utils';
|
8
8
|
var MAX_HEADING_LEVEL = 6;
|
9
9
|
function getHeadingLevel(match) {
|
10
10
|
return {
|
@@ -3,9 +3,9 @@ import { backspace, bindKeymapWithCommand, deleteKey, findKeyMapForBrowser, find
|
|
3
3
|
import { createNewParagraphAbove, createNewParagraphBelow, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics } from '@atlaskit/editor-common/utils';
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
5
5
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
6
|
-
import * as blockTypes from '
|
7
|
-
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockQuoteWithAnalytics } from '
|
8
|
-
import { isNodeAWrappingBlockNode } from '
|
6
|
+
import * as blockTypes from './block-types';
|
7
|
+
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockQuoteWithAnalytics } from './commands';
|
8
|
+
import { isNodeAWrappingBlockNode } from './utils';
|
9
9
|
var backspaceCommand = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
10
10
|
var del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
11
11
|
export default function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
@@ -6,10 +6,10 @@ import { browser } from '@atlaskit/editor-common/browser';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
7
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
9
|
-
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES } from '
|
10
|
-
import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from '
|
11
|
-
import { HEADING_KEYS } from '
|
12
|
-
import { areBlockTypesDisabled } from '
|
9
|
+
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES } from './block-types';
|
10
|
+
import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands';
|
11
|
+
import { HEADING_KEYS } from './consts';
|
12
|
+
import { areBlockTypesDisabled } from './utils';
|
13
13
|
var blockTypeForNode = function blockTypeForNode(node, schema) {
|
14
14
|
if (node.type === schema.nodes.heading) {
|
15
15
|
var maybeNode = HEADINGS_BY_LEVEL[node.attrs['level']];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
5
|
+
import ToolbarBlockType from './ToolbarBlockType';
|
6
|
+
var FloatingToolbarSettings = {
|
7
|
+
isSmall: true,
|
8
|
+
disabled: false,
|
9
|
+
isToolbarReducedSpacing: true,
|
10
|
+
shouldUseDefaultRole: false
|
11
|
+
};
|
12
|
+
export function FloatingToolbarComponent(_ref) {
|
13
|
+
var api = _ref.api;
|
14
|
+
var _useSharedPluginState = useSharedPluginState(api, ['blockType']),
|
15
|
+
blockTypeState = _useSharedPluginState.blockTypeState;
|
16
|
+
useEffect(function () {
|
17
|
+
editorExperiment('contextual_formatting_toolbar', true, {
|
18
|
+
exposure: true
|
19
|
+
});
|
20
|
+
}, []);
|
21
|
+
var boundSetBlockType = useCallback(function (name) {
|
22
|
+
var _api$core, _api$blockType;
|
23
|
+
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, INPUT_METHOD.FLOATING_TB));
|
24
|
+
}, [api]);
|
25
|
+
return /*#__PURE__*/React.createElement(ToolbarBlockType, {
|
26
|
+
isSmall: FloatingToolbarSettings.isSmall,
|
27
|
+
isDisabled: FloatingToolbarSettings.disabled,
|
28
|
+
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
29
|
+
setTextLevel: boundSetBlockType,
|
30
|
+
pluginState: blockTypeState,
|
31
|
+
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
32
|
+
api: api
|
33
|
+
});
|
34
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, NORMAL_TEXT, PANEL } from '
|
1
|
+
export { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, NORMAL_TEXT, PANEL } from '../pm-plugins/block-types';
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
3
3
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
4
|
-
import type { TextBlockTypes } from './block-types';
|
5
|
-
import type { InputMethod } from './commands/block-type';
|
4
|
+
import type { TextBlockTypes } from './pm-plugins/block-types';
|
5
|
+
import type { InputMethod } from './pm-plugins/commands/block-type';
|
6
6
|
import type { BlockTypeState } from './pm-plugins/main';
|
7
|
-
import type { BlockTypePluginOptions } from './types';
|
7
|
+
import type { BlockTypePluginOptions } from './pm-plugins/types';
|
8
8
|
export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
9
9
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
10
10
|
dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<PrimaryToolbarPlugin>];
|
@@ -16,7 +16,3 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
16
16
|
setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod) => EditorCommand;
|
17
17
|
};
|
18
18
|
}>;
|
19
|
-
declare const blockTypePlugin: BlockTypePlugin;
|
20
|
-
export { blockTypePlugin };
|
21
|
-
export { pluginKey } from './pm-plugins/main';
|
22
|
-
export type { BlockTypeState } from './pm-plugins/main';
|
package/dist/types/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
export { blockTypePlugin } from './
|
2
|
-
export type { BlockTypePlugin } from './
|
3
|
-
export type { BlockTypePluginOptions, BlockType } from './
|
4
|
-
export type { BlockTypeState } from './
|
5
|
-
export type { InputMethod } from './
|
6
|
-
export type { DropdownItem } from './
|
7
|
-
export type { TextBlockTypes } from './
|
1
|
+
export { blockTypePlugin } from './blockTypePlugin';
|
2
|
+
export type { BlockTypePlugin } from './blockTypePluginType';
|
3
|
+
export type { BlockTypePluginOptions, BlockType } from './pm-plugins/types';
|
4
|
+
export type { BlockTypeState } from './pm-plugins/main';
|
5
|
+
export type { InputMethod } from './pm-plugins/commands';
|
6
|
+
export type { DropdownItem } from './pm-plugins/ui/ToolbarBlockType';
|
7
|
+
export type { TextBlockTypes } from './pm-plugins/block-types';
|
@@ -3,8 +3,8 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
6
|
-
import type { BlockTypePlugin } from '../
|
7
|
-
import type { BlockType } from '
|
6
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
7
|
+
import type { BlockType } from './types';
|
8
8
|
export type BlockTypeState = {
|
9
9
|
currentBlockType: BlockType;
|
10
10
|
blockTypesDisabled: boolean;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
3
|
+
import type { BlockTypePlugin } from '../../blockTypePluginType';
|
4
|
+
interface FloatingToolbarComponentProps {
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
6
|
+
}
|
7
|
+
export declare function FloatingToolbarComponent({ api }: FloatingToolbarComponentProps): JSX.Element;
|
8
|
+
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
3
|
-
import type { BlockTypePlugin } from '
|
3
|
+
import type { BlockTypePlugin } from '../../blockTypePluginType';
|
4
4
|
interface PrimaryToolbarComponentProps {
|
5
5
|
isSmall: boolean;
|
6
6
|
isToolbarReducedSpacing: boolean;
|
@@ -8,9 +8,9 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
9
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
10
10
|
import { ThemeMutationObserver } from '@atlaskit/tokens';
|
11
|
+
import type { BlockTypePlugin } from '../../../blockTypePluginType';
|
11
12
|
import type { TextBlockTypes } from '../../block-types';
|
12
|
-
import type {
|
13
|
-
import type { BlockTypeState } from '../../pm-plugins/main';
|
13
|
+
import type { BlockTypeState } from '../../main';
|
14
14
|
import type { BlockType } from '../../types';
|
15
15
|
export type DropdownItem = MenuItem & {
|
16
16
|
value: BlockType;
|
@@ -1 +1 @@
|
|
1
|
-
export { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, NORMAL_TEXT, PANEL, } from '
|
1
|
+
export { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, NORMAL_TEXT, PANEL, } from '../pm-plugins/block-types';
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
3
3
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
4
|
-
import type { TextBlockTypes } from './block-types';
|
5
|
-
import type { InputMethod } from './commands/block-type';
|
4
|
+
import type { TextBlockTypes } from './pm-plugins/block-types';
|
5
|
+
import type { InputMethod } from './pm-plugins/commands/block-type';
|
6
6
|
import type { BlockTypeState } from './pm-plugins/main';
|
7
|
-
import type { BlockTypePluginOptions } from './types';
|
7
|
+
import type { BlockTypePluginOptions } from './pm-plugins/types';
|
8
8
|
export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
9
9
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
10
10
|
dependencies: [
|
@@ -19,7 +19,3 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
19
19
|
setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod) => EditorCommand;
|
20
20
|
};
|
21
21
|
}>;
|
22
|
-
declare const blockTypePlugin: BlockTypePlugin;
|
23
|
-
export { blockTypePlugin };
|
24
|
-
export { pluginKey } from './pm-plugins/main';
|
25
|
-
export type { BlockTypeState } from './pm-plugins/main';
|