@atlaskit/editor-core 187.41.8 → 187.42.3

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.
Files changed (138) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -2
  3. package/dist/cjs/plugins/code-block/index.js +1 -1
  4. package/dist/cjs/plugins/help-dialog/ui/index.js +1 -1
  5. package/dist/cjs/plugins/index.js +0 -7
  6. package/dist/cjs/plugins/insert-block/index.js +11 -11
  7. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  8. package/dist/cjs/plugins/panel/index.js +1 -1
  9. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/es2019/index.js +0 -6
  12. package/dist/es2019/labs/next/presets/default.js +1 -1
  13. package/dist/es2019/plugins/code-block/index.js +1 -1
  14. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
  15. package/dist/es2019/plugins/index.js +0 -1
  16. package/dist/es2019/plugins/insert-block/index.js +1 -1
  17. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  18. package/dist/es2019/plugins/panel/index.js +1 -1
  19. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  20. package/dist/es2019/version-wrapper.js +1 -1
  21. package/dist/esm/index.js +0 -6
  22. package/dist/esm/labs/next/presets/default.js +1 -1
  23. package/dist/esm/plugins/code-block/index.js +1 -1
  24. package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
  25. package/dist/esm/plugins/index.js +0 -1
  26. package/dist/esm/plugins/insert-block/index.js +1 -1
  27. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  28. package/dist/esm/plugins/panel/index.js +1 -1
  29. package/dist/esm/ui/ContentStyles/index.js +1 -1
  30. package/dist/esm/version-wrapper.js +1 -1
  31. package/dist/types/index.d.ts +0 -7
  32. package/dist/types/labs/next/presets/default.d.ts +1 -1
  33. package/dist/types/plugins/index.d.ts +0 -1
  34. package/dist/types/plugins/insert-block/types.d.ts +2 -2
  35. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  36. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
  37. package/dist/types/types/editor-props.d.ts +1 -1
  38. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  39. package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
  40. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  41. package/dist/types-ts4.5/index.d.ts +0 -7
  42. package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
  43. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  44. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -2
  45. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  46. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
  47. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  48. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  49. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -1
  50. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  51. package/package.json +9 -7
  52. package/report.api.md +1 -62
  53. package/tmp/api-report-tmp.d.ts +1 -51
  54. package/dist/cjs/plugins/block-type/commands/block-type.js +0 -202
  55. package/dist/cjs/plugins/block-type/commands/delete-and-move-cursor.js +0 -56
  56. package/dist/cjs/plugins/block-type/commands/delete-block-content.js +0 -45
  57. package/dist/cjs/plugins/block-type/commands/index.js +0 -68
  58. package/dist/cjs/plugins/block-type/consts.js +0 -15
  59. package/dist/cjs/plugins/block-type/index.js +0 -215
  60. package/dist/cjs/plugins/block-type/messages.js +0 -160
  61. package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +0 -104
  62. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +0 -34
  63. package/dist/cjs/plugins/block-type/pm-plugins/main.js +0 -151
  64. package/dist/cjs/plugins/block-type/styles.js +0 -15
  65. package/dist/cjs/plugins/block-type/types.js +0 -115
  66. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +0 -54
  67. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +0 -193
  68. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +0 -34
  69. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.js +0 -15
  70. package/dist/cjs/plugins/block-type/utils.js +0 -87
  71. package/dist/es2019/plugins/block-type/commands/block-type.js +0 -191
  72. package/dist/es2019/plugins/block-type/commands/delete-and-move-cursor.js +0 -54
  73. package/dist/es2019/plugins/block-type/commands/delete-block-content.js +0 -42
  74. package/dist/es2019/plugins/block-type/commands/index.js +0 -3
  75. package/dist/es2019/plugins/block-type/consts.js +0 -8
  76. package/dist/es2019/plugins/block-type/index.js +0 -201
  77. package/dist/es2019/plugins/block-type/messages.js +0 -153
  78. package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +0 -93
  79. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +0 -25
  80. package/dist/es2019/plugins/block-type/pm-plugins/main.js +0 -137
  81. package/dist/es2019/plugins/block-type/styles.js +0 -8
  82. package/dist/es2019/plugins/block-type/types.js +0 -93
  83. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +0 -44
  84. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +0 -170
  85. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +0 -49
  86. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.js +0 -8
  87. package/dist/es2019/plugins/block-type/utils.js +0 -76
  88. package/dist/esm/plugins/block-type/commands/block-type.js +0 -187
  89. package/dist/esm/plugins/block-type/commands/delete-and-move-cursor.js +0 -49
  90. package/dist/esm/plugins/block-type/commands/delete-block-content.js +0 -39
  91. package/dist/esm/plugins/block-type/commands/index.js +0 -3
  92. package/dist/esm/plugins/block-type/consts.js +0 -8
  93. package/dist/esm/plugins/block-type/index.js +0 -202
  94. package/dist/esm/plugins/block-type/messages.js +0 -153
  95. package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +0 -96
  96. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +0 -25
  97. package/dist/esm/plugins/block-type/pm-plugins/main.js +0 -142
  98. package/dist/esm/plugins/block-type/styles.js +0 -7
  99. package/dist/esm/plugins/block-type/types.js +0 -93
  100. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +0 -44
  101. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +0 -186
  102. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +0 -20
  103. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.js +0 -8
  104. package/dist/esm/plugins/block-type/utils.js +0 -77
  105. package/dist/types/plugins/block-type/commands/block-type.d.ts +0 -19
  106. package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +0 -12
  107. package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +0 -10
  108. package/dist/types/plugins/block-type/commands/index.d.ts +0 -4
  109. package/dist/types/plugins/block-type/consts.d.ts +0 -1
  110. package/dist/types/plugins/block-type/index.d.ts +0 -18
  111. package/dist/types/plugins/block-type/messages.d.ts +0 -152
  112. package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +0 -6
  113. package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +0 -5
  114. package/dist/types/plugins/block-type/pm-plugins/main.d.ts +0 -17
  115. package/dist/types/plugins/block-type/styles.d.ts +0 -2
  116. package/dist/types/plugins/block-type/types.d.ts +0 -40
  117. package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +0 -22
  118. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +0 -29
  119. package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +0 -8
  120. package/dist/types/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
  121. package/dist/types/plugins/block-type/utils.d.ts +0 -16
  122. package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +0 -19
  123. package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +0 -12
  124. package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +0 -10
  125. package/dist/types-ts4.5/plugins/block-type/commands/index.d.ts +0 -4
  126. package/dist/types-ts4.5/plugins/block-type/consts.d.ts +0 -1
  127. package/dist/types-ts4.5/plugins/block-type/index.d.ts +0 -20
  128. package/dist/types-ts4.5/plugins/block-type/messages.d.ts +0 -152
  129. package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +0 -6
  130. package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +0 -5
  131. package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +0 -17
  132. package/dist/types-ts4.5/plugins/block-type/styles.d.ts +0 -2
  133. package/dist/types-ts4.5/plugins/block-type/types.d.ts +0 -40
  134. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +0 -22
  135. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +0 -29
  136. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +0 -8
  137. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
  138. package/dist/types-ts4.5/plugins/block-type/utils.d.ts +0 -16
@@ -1,160 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.messages = void 0;
7
- var _reactIntlNext = require("react-intl-next");
8
- var messages = (0, _reactIntlNext.defineMessages)({
9
- normal: {
10
- id: 'fabric.editor.normal',
11
- defaultMessage: 'Normal text',
12
- description: 'This is the default text style'
13
- },
14
- heading1: {
15
- id: 'fabric.editor.heading1',
16
- defaultMessage: 'Heading 1',
17
- description: 'Used for the title of a section of your document, headings run from 1 (largest size) to 6 (smallest size)'
18
- },
19
- heading1Description: {
20
- id: 'fabric.editor.heading1Description',
21
- defaultMessage: 'Use this for a top level heading',
22
- description: 'Description of the main heading, heading 1'
23
- },
24
- heading2: {
25
- id: 'fabric.editor.heading2',
26
- defaultMessage: 'Heading 2',
27
- description: 'Used for the title of a section of your document, headings run from 1 (largest size) to 6 (smallest size)'
28
- },
29
- heading2Description: {
30
- id: 'fabric.editor.heading2Description',
31
- defaultMessage: 'Use this for key sections',
32
- description: 'Description of a subtitle heading or secondary heading'
33
- },
34
- heading3: {
35
- id: 'fabric.editor.heading3',
36
- defaultMessage: 'Heading 3',
37
- description: 'Used for the title of a section of your document, headings run from 1 (largest size) to 6 (smallest size)'
38
- },
39
- heading3Description: {
40
- id: 'fabric.editor.heading3Description',
41
- defaultMessage: 'Use this for sub sections and group headings',
42
- description: ''
43
- },
44
- heading4: {
45
- id: 'fabric.editor.heading4',
46
- defaultMessage: 'Heading 4',
47
- description: 'Used for the title of a section of your document, headings run from 1 (largest size) to 6 (smallest size)'
48
- },
49
- heading4Description: {
50
- id: 'fabric.editor.heading4Description',
51
- defaultMessage: 'Use this for deep headings',
52
- description: ''
53
- },
54
- heading5: {
55
- id: 'fabric.editor.heading5',
56
- defaultMessage: 'Heading 5',
57
- description: 'Used for the title of a section of your document, headings run from 1 (largest size) to 6 (smallest size)'
58
- },
59
- heading5Description: {
60
- id: 'fabric.editor.heading5Description',
61
- defaultMessage: 'Use this for grouping list items',
62
- description: ''
63
- },
64
- heading6: {
65
- id: 'fabric.editor.heading6',
66
- defaultMessage: 'Heading 6',
67
- description: 'Used for the title of a section of your document, headings run from 1 (largest size) to 6 (smallest size)'
68
- },
69
- heading6Description: {
70
- id: 'fabric.editor.heading6Description',
71
- defaultMessage: 'Use this for low level headings',
72
- description: ''
73
- },
74
- blockquote: {
75
- id: 'fabric.editor.blockquote2',
76
- defaultMessage: 'Quote',
77
- description: 'Quote some text'
78
- },
79
- blockquoteDescription: {
80
- id: 'fabric.editor.blockquote.description',
81
- defaultMessage: 'Insert a quote or citation',
82
- description: 'Quote some text'
83
- },
84
- codeblock: {
85
- id: 'fabric.editor.codeblock',
86
- defaultMessage: 'Code snippet',
87
- description: 'Insert a snippet/segment of code (code block)'
88
- },
89
- codeblockDescription: {
90
- id: 'fabric.editor.codeblock.description',
91
- defaultMessage: 'Display code with syntax highlighting',
92
- description: 'Insert a snippet/segment of code (code block)'
93
- },
94
- infoPanel: {
95
- id: 'fabric.editor.infoPanel',
96
- defaultMessage: 'Info panel',
97
- description: 'Visually distinguishes your text by adding a background colour (blue, purple, yellow, green, red)'
98
- },
99
- infoPanelDescription: {
100
- id: 'fabric.editor.infoPanel.description',
101
- defaultMessage: 'Highlight information in a colored panel',
102
- description: 'Visually distinguishes your text by adding a background colour (blue, purple, yellow, green, red)'
103
- },
104
- notePanel: {
105
- id: 'fabric.editor.notePanel',
106
- defaultMessage: 'Note panel',
107
- description: 'Visually distinguishes your text by adding a note panel'
108
- },
109
- notePanelDescription: {
110
- id: 'fabric.editor.notePanel.description',
111
- defaultMessage: 'Add a note in a colored panel',
112
- description: 'Visually distinguishes your text by adding a note panel'
113
- },
114
- successPanel: {
115
- id: 'fabric.editor.successPanel',
116
- defaultMessage: 'Success panel',
117
- description: 'Visually distinguishes your text by adding a success panel'
118
- },
119
- successPanelDescription: {
120
- id: 'fabric.editor.successPanel.description',
121
- defaultMessage: 'Add tips in a colored panel',
122
- description: 'Visually distinguishes your text by adding a success panel'
123
- },
124
- warningPanel: {
125
- id: 'fabric.editor.warningPanel',
126
- defaultMessage: 'Warning panel',
127
- description: 'Visually distinguishes your text by adding a warning panel'
128
- },
129
- warningPanelDescription: {
130
- id: 'fabric.editor.warningPanel.description',
131
- defaultMessage: 'Add a note of caution in a colored panel',
132
- description: 'Visually distinguishes your text by adding a warning panel'
133
- },
134
- errorPanel: {
135
- id: 'fabric.editor.errorPanel',
136
- defaultMessage: 'Error panel',
137
- description: 'Visually distinguishes your text by adding a error panel'
138
- },
139
- errorPanelDescription: {
140
- id: 'fabric.editor.errorPanel.description',
141
- defaultMessage: 'Call out errors in a colored panel',
142
- description: 'Visually distinguishes your text by adding a error panel'
143
- },
144
- customPanel: {
145
- id: 'fabric.editor.customPanel',
146
- defaultMessage: 'Custom panel',
147
- description: 'Visually distinguishes your panel by adding a emoji icon and background color'
148
- },
149
- customPanelDescription: {
150
- id: 'fabric.editor.customPanel.description',
151
- defaultMessage: 'Add a note with an emoji and colored background',
152
- description: 'Visually distinguishes your panel by adding a emoji icon and background color '
153
- },
154
- other: {
155
- id: 'fabric.editor.other',
156
- defaultMessage: 'Others...',
157
- description: 'Other text formatting'
158
- }
159
- });
160
- exports.messages = messages;
@@ -1,104 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _utils = require("@atlaskit/editor-common/utils");
12
- var _commands = require("@atlaskit/editor-common/commands");
13
- var _utils2 = require("../utils");
14
- var MAX_HEADING_LEVEL = 6;
15
- function getHeadingLevel(match) {
16
- return {
17
- level: match[1].length
18
- };
19
- }
20
- function headingRule(nodeType, maxLevel) {
21
- return (0, _utils2.createWrappingTextBlockRule)({
22
- match: new RegExp('^(#{1,' + maxLevel + '})\\s$'),
23
- nodeType: nodeType,
24
- getAttrs: getHeadingLevel
25
- });
26
- }
27
- function blockQuoteRule(nodeType) {
28
- return (0, _utils2.createJoinNodesRule)(/^\s*>\s$/, nodeType);
29
- }
30
-
31
- /**
32
- * Get heading rules
33
- *
34
- * @param {Schema} schema
35
- * @returns {InputRuleWithHandler[]}
36
- */
37
- function getHeadingRules(editorAnalyticsAPI, schema) {
38
- // '# ' for h1, '## ' for h2 and etc
39
- var hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
40
- var leftNodeReplacementHashRule = (0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(#{1,6})\\s$")), function (state, match, start, end) {
41
- var level = match[1].length;
42
- return (0, _commands.insertBlock)(state, schema.nodes.heading, start, end, {
43
- level: level
44
- });
45
- });
46
-
47
- // New analytics handler
48
- var ruleWithHeadingAnalytics = (0, _utils.inputRuleWithAnalytics)(function (_state, matchResult) {
49
- return {
50
- action: _analytics.ACTION.FORMATTED,
51
- actionSubject: _analytics.ACTION_SUBJECT.TEXT,
52
- eventType: _analytics.EVENT_TYPE.TRACK,
53
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_HEADING,
54
- attributes: {
55
- inputMethod: _analytics.INPUT_METHOD.FORMATTING,
56
- newHeadingLevel: getHeadingLevel(matchResult).level
57
- }
58
- };
59
- }, editorAnalyticsAPI);
60
- return [ruleWithHeadingAnalytics(hashRule), ruleWithHeadingAnalytics(leftNodeReplacementHashRule)];
61
- }
62
-
63
- /**
64
- * Get all block quote input rules
65
- *
66
- * @param {Schema} schema
67
- * @returns {InputRuleWithHandler[]}
68
- */
69
- function getBlockQuoteRules(editorAnalyticsAPI, schema) {
70
- // '> ' for blockquote
71
- var greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
72
- var leftNodeReplacementGreatherRule = (0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\s*>\\s$")), function (state, _match, start, end) {
73
- return (0, _commands.insertBlock)(state, schema.nodes.blockquote, start, end);
74
- });
75
-
76
- // Analytics V3 handler
77
- var ruleWithBlockQuoteAnalytics = (0, _utils.inputRuleWithAnalytics)({
78
- action: _analytics.ACTION.FORMATTED,
79
- actionSubject: _analytics.ACTION_SUBJECT.TEXT,
80
- eventType: _analytics.EVENT_TYPE.TRACK,
81
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
82
- attributes: {
83
- inputMethod: _analytics.INPUT_METHOD.FORMATTING
84
- }
85
- }, editorAnalyticsAPI);
86
- return [ruleWithBlockQuoteAnalytics(greatherThanRule), ruleWithBlockQuoteAnalytics(leftNodeReplacementGreatherRule)];
87
- }
88
- function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
89
- var rules = [];
90
- if (schema.nodes.heading) {
91
- rules.push.apply(rules, (0, _toConsumableArray2.default)(getHeadingRules(editorAnalyticsAPI, schema)));
92
- }
93
- if (schema.nodes.blockquote) {
94
- rules.push.apply(rules, (0, _toConsumableArray2.default)(getBlockQuoteRules(editorAnalyticsAPI, schema)));
95
- }
96
- if (rules.length !== 0) {
97
- return (0, _prosemirrorInputRules.createPlugin)('block-type', rules, {
98
- isBlockNodeRule: true
99
- });
100
- }
101
- return;
102
- }
103
- var _default = inputRulePlugin;
104
- exports.default = _default;
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = keymapPlugin;
8
- var _history = require("@atlaskit/editor-prosemirror/history");
9
- var _commands = require("@atlaskit/editor-prosemirror/commands");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _keymaps = require("@atlaskit/editor-common/keymaps");
12
- var _utils = require("@atlaskit/editor-common/utils");
13
- var blockTypes = _interopRequireWildcard(require("../types"));
14
- var _commands2 = require("../commands");
15
- var _utils2 = require("../utils");
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
- var backspaceCommand = (0, _commands.chainCommands)(_commands2.cleanUpAtTheStartOfDocument, (0, _commands2.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _commands2.deleteAndMoveCursor);
19
- var del = (0, _commands.chainCommands)((0, _utils.deleteEmptyParagraphAndMoveBlockUp)(_utils2.isNodeAWrappingBlockNode), (0, _commands2.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _commands2.deleteAndMoveCursor);
20
- function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
21
- var list = {};
22
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.insertNewLine.common, (0, _utils.insertNewLineWithAnalytics)(editorAnalyticsApi), list);
23
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveUp.common, _utils.createNewParagraphAbove, list);
24
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveDown.common, _utils.createNewParagraphBelow, list);
25
- (0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findKeyMapForBrowser)(_keymaps.redo), _history.redo, list);
26
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.undo.common, _history.undo, list);
27
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, backspaceCommand, list);
28
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteKey.common, del, list);
29
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.forwardDelete.mac, del, list);
30
- if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
31
- (0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBlockQuote), (0, _commands2.insertBlockQuoteWithAnalytics)(_analytics.INPUT_METHOD.KEYBOARD, editorAnalyticsApi), list);
32
- }
33
- return (0, _keymaps.keymap)(list);
34
- }
@@ -1,151 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.pluginKey = exports.createPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
- var _state = require("@atlaskit/editor-prosemirror/state");
11
- var _utils = require("@atlaskit/editor-common/utils");
12
- var _analytics = require("@atlaskit/editor-common/analytics");
13
- var _types = require("../types");
14
- var _consts = require("../consts");
15
- var _commands = require("../commands");
16
- var _utils2 = require("../utils");
17
- 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; }
18
- 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; }
19
- var blockTypeForNode = function blockTypeForNode(node, schema) {
20
- if (node.type === schema.nodes.heading) {
21
- var maybeNode = _types.HEADINGS_BY_LEVEL[node.attrs['level']];
22
- if (maybeNode) {
23
- return maybeNode;
24
- }
25
- } else if (node.type === schema.nodes.paragraph) {
26
- return _types.NORMAL_TEXT;
27
- }
28
- return _types.OTHER;
29
- };
30
- var isBlockTypeSchemaSupported = function isBlockTypeSchemaSupported(blockType, state) {
31
- switch (blockType) {
32
- case _types.NORMAL_TEXT:
33
- return !!state.schema.nodes.paragraph;
34
- case _types.HEADING_1:
35
- case _types.HEADING_2:
36
- case _types.HEADING_3:
37
- case _types.HEADING_4:
38
- case _types.HEADING_5:
39
- case _types.HEADING_6:
40
- return !!state.schema.nodes.heading;
41
- case _types.BLOCK_QUOTE:
42
- return !!state.schema.nodes.blockquote;
43
- case _types.CODE_BLOCK:
44
- return !!state.schema.nodes.codeBlock;
45
- case _types.PANEL:
46
- return !!state.schema.nodes.panel;
47
- }
48
- return;
49
- };
50
- var detectBlockType = function detectBlockType(availableBlockTypes, state) {
51
- // Before a document is loaded, there is no selection.
52
- if (!state.selection) {
53
- return _types.NORMAL_TEXT;
54
- }
55
- var blockType;
56
- var _state$selection = state.selection,
57
- $from = _state$selection.$from,
58
- $to = _state$selection.$to;
59
- state.doc.nodesBetween($from.pos, $to.pos, function (node) {
60
- var nodeBlockType = availableBlockTypes.filter(function (blockType) {
61
- return blockType === blockTypeForNode(node, state.schema);
62
- });
63
- if (nodeBlockType.length > 0) {
64
- if (!blockType) {
65
- blockType = nodeBlockType[0];
66
- } else if (blockType !== _types.OTHER && blockType !== nodeBlockType[0]) {
67
- blockType = _types.OTHER;
68
- }
69
- }
70
- });
71
- return blockType || _types.OTHER;
72
- };
73
- var autoformatHeading = function autoformatHeading(headingLevel, view, editorAnalyticsApi) {
74
- if (headingLevel === 0) {
75
- (0, _commands.setNormalTextWithAnalytics)(_analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi)(view.state, view.dispatch);
76
- } else {
77
- (0, _commands.setHeadingWithAnalytics)(headingLevel, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi)(view.state, view.dispatch);
78
- }
79
- return true;
80
- };
81
- var pluginKey = new _state.PluginKey('blockTypePlugin');
82
- exports.pluginKey = pluginKey;
83
- var createPlugin = function createPlugin(editorAnalyticsApi, dispatch, lastNodeMustBeParagraph) {
84
- var altKeyLocation = 0;
85
- return new _safePlugin.SafePlugin({
86
- appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
87
- if (lastNodeMustBeParagraph) {
88
- var pos = newState.doc.resolve(newState.doc.content.size - 1);
89
- var lastNode = pos.node(1);
90
- var paragraph = newState.schema.nodes.paragraph;
91
- if (lastNode && lastNode.isBlock && lastNode.type !== paragraph) {
92
- return newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create()).setMeta('addToHistory', false);
93
- }
94
- }
95
- },
96
- state: {
97
- init: function init(_config, state) {
98
- var availableBlockTypes = _types.TEXT_BLOCK_TYPES.filter(function (blockType) {
99
- return isBlockTypeSchemaSupported(blockType, state);
100
- });
101
- var availableWrapperBlockTypes = _types.WRAPPER_BLOCK_TYPES.filter(function (blockType) {
102
- return isBlockTypeSchemaSupported(blockType, state);
103
- });
104
- return {
105
- currentBlockType: detectBlockType(availableBlockTypes, state),
106
- blockTypesDisabled: (0, _utils2.areBlockTypesDisabled)(state),
107
- availableBlockTypes: availableBlockTypes,
108
- availableWrapperBlockTypes: availableWrapperBlockTypes
109
- };
110
- },
111
- apply: function apply(_tr, oldPluginState, _oldState, newState) {
112
- var newPluginState = _objectSpread(_objectSpread({}, oldPluginState), {}, {
113
- currentBlockType: detectBlockType(oldPluginState.availableBlockTypes, newState),
114
- blockTypesDisabled: (0, _utils2.areBlockTypesDisabled)(newState)
115
- });
116
- if (newPluginState.currentBlockType !== oldPluginState.currentBlockType || newPluginState.blockTypesDisabled !== oldPluginState.blockTypesDisabled) {
117
- dispatch(pluginKey, newPluginState);
118
- }
119
- return newPluginState;
120
- }
121
- },
122
- key: pluginKey,
123
- props: {
124
- /**
125
- * As we only want the left alt key to work for headings shortcuts on Windows
126
- * we can't use prosemirror-keymap and need to handle these shortcuts specially
127
- * Shortcut on Mac: Cmd-Opt-{heading level}
128
- * Shortcut on Windows: Ctrl-LeftAlt-{heading level}
129
- */
130
- handleKeyDown: function handleKeyDown(view, event) {
131
- var headingLevel = _consts.HEADING_KEYS.indexOf(event.keyCode);
132
- if (headingLevel > -1 && event.altKey) {
133
- if (_utils.browser.mac && event.metaKey) {
134
- return autoformatHeading(headingLevel, view, editorAnalyticsApi);
135
- } else if (!_utils.browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
136
- return autoformatHeading(headingLevel, view, editorAnalyticsApi);
137
- }
138
- } else if (event.key === 'Alt') {
139
- // event.location is for the current key only; when a user hits Ctrl-Alt-1 the
140
- // location refers to the location of the '1' key
141
- // We store the location of the Alt key when it is hit to check against later
142
- altKeyLocation = event.location;
143
- } else if (!event.altKey) {
144
- altKeyLocation = 0;
145
- }
146
- return false;
147
- }
148
- }
149
- });
150
- };
151
- exports.createPlugin = createPlugin;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.blocktypeStyles = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = require("@emotion/react");
10
- var _styles = require("@atlaskit/editor-common/styles");
11
- var _templateObject;
12
- var blocktypeStyles = function blocktypeStyles(props) {
13
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", ";\n ", ";\n }\n"])), _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(props));
14
- };
15
- exports.blocktypeStyles = blocktypeStyles;
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.WRAPPER_BLOCK_TYPES = exports.TEXT_BLOCK_TYPES = exports.PANEL = exports.OTHER = exports.NORMAL_TEXT = exports.HEADING_6 = exports.HEADING_5 = exports.HEADING_4 = exports.HEADING_3 = exports.HEADING_2 = exports.HEADING_1 = exports.HEADINGS_BY_NAME = exports.HEADINGS_BY_LEVEL = exports.CODE_BLOCK = exports.BLOCK_QUOTE = exports.ALL_BLOCK_TYPES = void 0;
7
- var _messages = require("./messages");
8
- // The names of the blocks don't map precisely to schema nodes, because
9
- // of concepts like "paragraph" <-> "Normal text" and "Unknown".
10
- //
11
- // (there are also different blocks for different types of panel, when
12
- // they're really all just a panel node)
13
- //
14
- // Rather than half-match half-not, this plugin introduces its own
15
- // nomenclature for what 'block type' is active.
16
-
17
- var NORMAL_TEXT = {
18
- name: 'normal',
19
- title: _messages.messages.normal,
20
- nodeName: 'paragraph',
21
- tagName: 'p'
22
- };
23
- exports.NORMAL_TEXT = NORMAL_TEXT;
24
- var HEADING_1 = {
25
- name: 'heading1',
26
- title: _messages.messages.heading1,
27
- nodeName: 'heading',
28
- tagName: 'h1',
29
- level: 1
30
- };
31
- exports.HEADING_1 = HEADING_1;
32
- var HEADING_2 = {
33
- name: 'heading2',
34
- title: _messages.messages.heading2,
35
- nodeName: 'heading',
36
- tagName: 'h2',
37
- level: 2
38
- };
39
- exports.HEADING_2 = HEADING_2;
40
- var HEADING_3 = {
41
- name: 'heading3',
42
- title: _messages.messages.heading3,
43
- nodeName: 'heading',
44
- tagName: 'h3',
45
- level: 3
46
- };
47
- exports.HEADING_3 = HEADING_3;
48
- var HEADING_4 = {
49
- name: 'heading4',
50
- title: _messages.messages.heading4,
51
- nodeName: 'heading',
52
- tagName: 'h4',
53
- level: 4
54
- };
55
- exports.HEADING_4 = HEADING_4;
56
- var HEADING_5 = {
57
- name: 'heading5',
58
- title: _messages.messages.heading5,
59
- nodeName: 'heading',
60
- tagName: 'h5',
61
- level: 5
62
- };
63
- exports.HEADING_5 = HEADING_5;
64
- var HEADING_6 = {
65
- name: 'heading6',
66
- title: _messages.messages.heading6,
67
- nodeName: 'heading',
68
- tagName: 'h6',
69
- level: 6
70
- };
71
- exports.HEADING_6 = HEADING_6;
72
- var BLOCK_QUOTE = {
73
- name: 'blockquote',
74
- title: _messages.messages.blockquote,
75
- nodeName: 'blockquote'
76
- };
77
- exports.BLOCK_QUOTE = BLOCK_QUOTE;
78
- var CODE_BLOCK = {
79
- name: 'codeblock',
80
- title: _messages.messages.codeblock,
81
- nodeName: 'codeBlock'
82
- };
83
- exports.CODE_BLOCK = CODE_BLOCK;
84
- var PANEL = {
85
- name: 'panel',
86
- title: _messages.messages.infoPanel,
87
- nodeName: 'panel'
88
- };
89
- exports.PANEL = PANEL;
90
- var OTHER = {
91
- name: 'other',
92
- title: _messages.messages.other,
93
- nodeName: ''
94
- };
95
- exports.OTHER = OTHER;
96
- var TEXT_BLOCK_TYPES = [NORMAL_TEXT, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6];
97
- exports.TEXT_BLOCK_TYPES = TEXT_BLOCK_TYPES;
98
- var WRAPPER_BLOCK_TYPES = [BLOCK_QUOTE, CODE_BLOCK, PANEL];
99
- exports.WRAPPER_BLOCK_TYPES = WRAPPER_BLOCK_TYPES;
100
- var ALL_BLOCK_TYPES = TEXT_BLOCK_TYPES.concat(WRAPPER_BLOCK_TYPES);
101
- exports.ALL_BLOCK_TYPES = ALL_BLOCK_TYPES;
102
- var HEADINGS_BY_LEVEL = TEXT_BLOCK_TYPES.reduce(function (acc, blockType) {
103
- if (blockType.level && blockType.nodeName === 'heading') {
104
- acc[blockType.level] = blockType;
105
- }
106
- return acc;
107
- }, {});
108
- exports.HEADINGS_BY_LEVEL = HEADINGS_BY_LEVEL;
109
- var HEADINGS_BY_NAME = TEXT_BLOCK_TYPES.reduce(function (acc, blockType) {
110
- if (blockType.level && blockType.nodeName === 'heading') {
111
- acc[blockType.name] = blockType;
112
- }
113
- return acc;
114
- }, {});
115
- exports.HEADINGS_BY_NAME = HEADINGS_BY_NAME;
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.messages = exports.BlockTypeButton = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _react2 = require("@emotion/react");
10
- var _reactIntlNext = require("react-intl-next");
11
- var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
12
- var _textStyle = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/text-style"));
13
- var _styles = require("@atlaskit/editor-common/styles");
14
- var _uiMenu = require("@atlaskit/editor-common/ui-menu");
15
- var _types = require("../../types");
16
- var _styled = require("./styled");
17
- /** @jsx jsx */
18
-
19
- var messages = (0, _reactIntlNext.defineMessages)({
20
- textStyles: {
21
- id: 'fabric.editor.textStyles',
22
- defaultMessage: 'Text styles',
23
- description: 'Menu provides access to various heading styles or normal text'
24
- }
25
- });
26
- exports.messages = messages;
27
- var BlockTypeButton = function BlockTypeButton(props) {
28
- var labelTextStyles = props.formatMessage(messages.textStyles);
29
- return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
30
- spacing: props.isReducedSpacing ? 'none' : 'default',
31
- selected: props.selected,
32
- className: "block-type-btn",
33
- disabled: props.disabled,
34
- onClick: props.onClick,
35
- onKeyDown: props.onKeyDown,
36
- title: labelTextStyles,
37
- "aria-label": labelTextStyles,
38
- "aria-haspopup": true,
39
- "aria-expanded": props['aria-expanded'],
40
- iconAfter: (0, _react2.jsx)("span", {
41
- css: [_styles.wrapperStyle, props.isSmall && _styled.wrapperSmallStyle],
42
- "data-testid": "toolbar-block-type-text-styles-icon"
43
- }, props.isSmall && (0, _react2.jsx)(_textStyle.default, {
44
- label: labelTextStyles
45
- }), (0, _react2.jsx)("span", {
46
- css: _styled.expandIconWrapperStyle
47
- }, (0, _react2.jsx)(_chevronDown.default, {
48
- label: ""
49
- })))
50
- }, !props.isSmall && (0, _react2.jsx)("span", {
51
- css: [_styled.buttonContentStyle, props.isReducedSpacing && _styled.buttonContentReducedSpacingStyle]
52
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, props.title || _types.NORMAL_TEXT.title)));
53
- };
54
- exports.BlockTypeButton = BlockTypeButton;