@atlaskit/editor-core 187.9.2 → 187.10.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.
Files changed (201) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +17 -0
  3. package/dist/cjs/commands/index.js +8 -134
  4. package/dist/cjs/labs/next/presets/default.js +2 -2
  5. package/dist/cjs/plugins/base/index.js +2 -2
  6. package/dist/cjs/plugins/block-type/commands/block-type.js +34 -36
  7. package/dist/cjs/plugins/block-type/commands/transform-to-code-block.js +1 -2
  8. package/dist/cjs/plugins/block-type/index.js +16 -13
  9. package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +19 -18
  10. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +12 -14
  11. package/dist/cjs/plugins/block-type/pm-plugins/main.js +9 -9
  12. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +7 -7
  13. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +3 -4
  14. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +13 -5
  15. package/dist/cjs/plugins/block-type/utils.js +73 -2
  16. package/dist/cjs/plugins/caption/pm-plugins/keymap.js +2 -2
  17. package/dist/cjs/plugins/floating-toolbar/index.js +154 -132
  18. package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +11 -10
  19. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +14 -7
  20. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +6 -1
  21. package/dist/cjs/plugins/index.js +0 -7
  22. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
  23. package/dist/cjs/plugins/media/toolbar/alt-text.js +6 -6
  24. package/dist/cjs/plugins/media/toolbar/linking.js +4 -1
  25. package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +2 -2
  26. package/dist/cjs/plugins/media/utils/media-common.js +5 -5
  27. package/dist/cjs/plugins/undo-redo/pm-plugins/keymaps.js +2 -2
  28. package/dist/cjs/ui/ColorPickerButton/index.js +3 -3
  29. package/dist/cjs/ui/styles.js +4 -11
  30. package/dist/cjs/utils/index.js +4 -80
  31. package/dist/cjs/utils/input-rules.js +6 -66
  32. package/dist/cjs/utils/mark.js +2 -38
  33. package/dist/cjs/version-wrapper.js +1 -1
  34. package/dist/cjs/version.json +1 -1
  35. package/dist/es2019/commands/index.js +1 -128
  36. package/dist/es2019/labs/next/presets/default.js +1 -1
  37. package/dist/es2019/plugins/base/index.js +1 -1
  38. package/dist/es2019/plugins/block-type/commands/block-type.js +11 -13
  39. package/dist/es2019/plugins/block-type/commands/transform-to-code-block.js +1 -2
  40. package/dist/es2019/plugins/block-type/index.js +21 -12
  41. package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +18 -18
  42. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +8 -9
  43. package/dist/es2019/plugins/block-type/pm-plugins/main.js +9 -9
  44. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
  45. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
  46. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +21 -2
  47. package/dist/es2019/plugins/block-type/utils.js +70 -1
  48. package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
  49. package/dist/es2019/plugins/floating-toolbar/index.js +152 -128
  50. package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +12 -8
  51. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +5 -4
  52. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +12 -1
  53. package/dist/es2019/plugins/index.js +0 -1
  54. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +3 -1
  55. package/dist/es2019/plugins/media/toolbar/alt-text.js +10 -6
  56. package/dist/es2019/plugins/media/toolbar/linking.js +8 -1
  57. package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +5 -3
  58. package/dist/es2019/plugins/media/utils/media-common.js +1 -1
  59. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
  60. package/dist/es2019/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
  61. package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
  62. package/dist/es2019/ui/styles.js +0 -16
  63. package/dist/es2019/utils/index.js +0 -80
  64. package/dist/es2019/utils/input-rules.js +4 -61
  65. package/dist/es2019/utils/mark.js +0 -33
  66. package/dist/es2019/version-wrapper.js +1 -1
  67. package/dist/es2019/version.json +1 -1
  68. package/dist/esm/commands/index.js +7 -125
  69. package/dist/esm/labs/next/presets/default.js +1 -1
  70. package/dist/esm/plugins/base/index.js +1 -1
  71. package/dist/esm/plugins/block-type/commands/block-type.js +11 -13
  72. package/dist/esm/plugins/block-type/commands/transform-to-code-block.js +1 -2
  73. package/dist/esm/plugins/block-type/index.js +15 -12
  74. package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +18 -18
  75. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +8 -9
  76. package/dist/esm/plugins/block-type/pm-plugins/main.js +9 -9
  77. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
  78. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
  79. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +8 -4
  80. package/dist/esm/plugins/block-type/utils.js +69 -1
  81. package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
  82. package/dist/esm/plugins/floating-toolbar/index.js +153 -131
  83. package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +9 -7
  84. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +14 -7
  85. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +6 -1
  86. package/dist/esm/plugins/index.js +0 -1
  87. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
  88. package/dist/esm/plugins/media/toolbar/alt-text.js +6 -6
  89. package/dist/esm/plugins/media/toolbar/linking.js +4 -1
  90. package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -2
  91. package/dist/esm/plugins/media/utils/media-common.js +1 -1
  92. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
  93. package/dist/esm/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
  94. package/dist/esm/ui/ColorPickerButton/index.js +3 -3
  95. package/dist/esm/ui/styles.js +3 -6
  96. package/dist/esm/utils/index.js +3 -77
  97. package/dist/esm/utils/input-rules.js +4 -61
  98. package/dist/esm/utils/mark.js +0 -35
  99. package/dist/esm/version-wrapper.js +1 -1
  100. package/dist/esm/version.json +1 -1
  101. package/dist/types/commands/index.d.ts +0 -6
  102. package/dist/types/labs/next/presets/default.d.ts +40 -8
  103. package/dist/types/plugins/block-type/commands/block-type.d.ts +5 -6
  104. package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
  105. package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +1 -1
  106. package/dist/types/plugins/block-type/index.d.ts +1 -1
  107. package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
  108. package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
  109. package/dist/types/plugins/block-type/pm-plugins/main.d.ts +2 -1
  110. package/dist/types/plugins/block-type/styles.d.ts +1 -1
  111. package/dist/types/plugins/block-type/types.d.ts +2 -3
  112. package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
  113. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
  114. package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
  115. package/dist/types/plugins/block-type/utils.d.ts +15 -1
  116. package/dist/types/plugins/date/index.d.ts +2 -2
  117. package/dist/types/plugins/floating-toolbar/index.d.ts +1 -7
  118. package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +2 -1
  119. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
  120. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +1 -1
  121. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
  122. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +2 -1
  123. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -3
  124. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +1 -1
  125. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
  126. package/dist/types/plugins/index.d.ts +0 -1
  127. package/dist/types/plugins/media/index.d.ts +2 -2
  128. package/dist/types/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
  129. package/dist/types/plugins/media/ui/MediaLinkingToolbar.d.ts +3 -3
  130. package/dist/types/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
  131. package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  132. package/dist/types/types/index.d.ts +1 -1
  133. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  134. package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
  135. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  136. package/dist/types/ui/styles.d.ts +0 -3
  137. package/dist/types/utils/index.d.ts +0 -6
  138. package/dist/types/utils/input-rules.d.ts +4 -16
  139. package/dist/types/utils/mark.d.ts +0 -1
  140. package/dist/types-ts4.5/commands/index.d.ts +0 -6
  141. package/dist/types-ts4.5/labs/next/presets/default.d.ts +44 -8
  142. package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +5 -6
  143. package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
  144. package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +1 -1
  145. package/dist/types-ts4.5/plugins/block-type/index.d.ts +1 -1
  146. package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
  147. package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
  148. package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +2 -1
  149. package/dist/types-ts4.5/plugins/block-type/styles.d.ts +1 -1
  150. package/dist/types-ts4.5/plugins/block-type/types.d.ts +2 -3
  151. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
  152. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
  153. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
  154. package/dist/types-ts4.5/plugins/block-type/utils.d.ts +15 -1
  155. package/dist/types-ts4.5/plugins/date/index.d.ts +2 -2
  156. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +1 -7
  157. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +2 -1
  158. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
  159. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +1 -1
  160. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
  161. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +2 -1
  162. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -3
  163. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +1 -1
  164. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
  165. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  166. package/dist/types-ts4.5/plugins/media/index.d.ts +2 -2
  167. package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
  168. package/dist/types-ts4.5/plugins/media/ui/MediaLinkingToolbar.d.ts +3 -3
  169. package/dist/types-ts4.5/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
  170. package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  171. package/dist/types-ts4.5/types/index.d.ts +1 -1
  172. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  173. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
  174. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  175. package/dist/types-ts4.5/ui/styles.d.ts +0 -3
  176. package/dist/types-ts4.5/utils/index.d.ts +0 -6
  177. package/dist/types-ts4.5/utils/input-rules.d.ts +4 -16
  178. package/dist/types-ts4.5/utils/mark.d.ts +0 -1
  179. package/package.json +6 -5
  180. package/report.api.md +9 -37
  181. package/tmp/api-report-tmp.d.ts +8 -34
  182. package/dist/cjs/plugins/editor-disabled/index.js +0 -75
  183. package/dist/cjs/types/allowed-block-types.js +0 -5
  184. package/dist/cjs/utils/keymap.js +0 -38
  185. package/dist/es2019/plugins/editor-disabled/index.js +0 -62
  186. package/dist/es2019/types/allowed-block-types.js +0 -1
  187. package/dist/es2019/utils/keymap.js +0 -33
  188. package/dist/esm/plugins/editor-disabled/index.js +0 -66
  189. package/dist/esm/types/allowed-block-types.js +0 -1
  190. package/dist/esm/utils/keymap.js +0 -33
  191. package/dist/types/plugins/editor-disabled/index.d.ts +0 -13
  192. package/dist/types/types/allowed-block-types.d.ts +0 -1
  193. package/dist/types/utils/keymap.d.ts +0 -11
  194. package/dist/types-ts4.5/plugins/editor-disabled/index.d.ts +0 -13
  195. package/dist/types-ts4.5/types/allowed-block-types.d.ts +0 -1
  196. package/dist/types-ts4.5/utils/keymap.d.ts +0 -11
  197. /package/dist/cjs/{keymaps → plugins/block-type}/consts.js +0 -0
  198. /package/dist/es2019/{keymaps → plugins/block-type}/consts.js +0 -0
  199. /package/dist/esm/{keymaps → plugins/block-type}/consts.js +0 -0
  200. /package/dist/types/{keymaps → plugins/block-type}/consts.d.ts +0 -0
  201. /package/dist/types-ts4.5/{keymaps → plugins/block-type}/consts.d.ts +0 -0
@@ -13,6 +13,7 @@ import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
13
13
  import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
14
14
  import type { ActivityProvider } from '@atlaskit/activity-provider';
15
15
  import type { AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
16
+ import type { AllowedBlockTypes } from '@atlaskit/editor-common/types';
16
17
  import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
17
18
  import type { AnalyticsEventPayload as AnalyticsEventPayload_2 } from '@atlaskit/analytics-next/AnalyticsEvent';
18
19
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -23,6 +24,7 @@ import { CardProvider } from '@atlaskit/editor-common/provider-factory';
23
24
  import { Color } from '@atlaskit/status/element';
24
25
  import { Command as Command_2 } from '@atlaskit/editor-common/types';
25
26
  import { ComponentType } from 'react';
27
+ import type { ConfigWithNodeInfo } from '@atlaskit/editor-plugin-floating-toolbar';
26
28
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
27
29
  import type { ContextUpdateHandler } from '@atlaskit/editor-common/types';
28
30
  import { createTable } from '@atlaskit/editor-plugin-table/commands';
@@ -39,6 +41,7 @@ import { DropdownOptionT } from '@atlaskit/editor-common/types';
39
41
  import type { EditorActionsOptions } from '@atlaskit/editor-common/types';
40
42
  import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
41
43
  import { EditorAppearance } from '@atlaskit/editor-common/types';
44
+ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
42
45
  import { FeatureFlags as EditorFeatureFlags } from '@atlaskit/editor-common/types';
43
46
  import { EditorPlugin } from '@atlaskit/editor-common/types';
44
47
  import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
@@ -101,6 +104,7 @@ import { MentionProvider } from '@atlaskit/mention/resource';
101
104
  import type { MentionProvider as MentionProvider_2 } from '@atlaskit/mention';
102
105
  import { MentionResource } from '@atlaskit/mention/resource';
103
106
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
107
+ import type { MessageDescriptor } from 'react-intl-next';
104
108
  import { default as messages } from '@atlaskit/editor-common/messages';
105
109
  import { NextEditorPlugin } from '@atlaskit/editor-common/types';
106
110
  import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
@@ -180,9 +184,6 @@ type AddItemTransactionCreator = (opts: {
180
184
  itemLocalId: string;
181
185
  }) => Transaction | null;
182
186
 
183
- // @public (undocumented)
184
- type AllowedBlockTypes = 'blockquote' | 'codeBlock' | 'hardBreak' | 'heading';
185
-
186
187
  // @public (undocumented)
187
188
  interface AllSelectionData {
188
189
  // (undocumented)
@@ -383,13 +384,6 @@ export type CommandDispatch = (tr: Transaction) => void;
383
384
  // @public (undocumented)
384
385
  export const commitStatusPicker: () => (editorView: EditorView) => void;
385
386
 
386
- // @public (undocumented)
387
- type ConfigWithNodeInfo = {
388
- config: FloatingToolbarConfig | undefined;
389
- pos: number;
390
- node: Node_2;
391
- };
392
-
393
387
  // @public (undocumented)
394
388
  export function ContextPanel(props: Props_4): jsx.JSX.Element;
395
389
 
@@ -704,16 +698,6 @@ type EditorContextProps = {
704
698
  editorActions?: EditorActions;
705
699
  };
706
700
 
707
- // @public (undocumented)
708
- const editorDisabledPlugin: NextEditorPlugin<'editorDisabled', {
709
- sharedState: EditorDisabledPluginState;
710
- }>;
711
-
712
- // @public (undocumented)
713
- type EditorDisabledPluginState = {
714
- editorDisabled: boolean;
715
- };
716
-
717
701
  export { EditorFeatureFlags }
718
702
 
719
703
  // @public (undocumented)
@@ -1099,7 +1083,7 @@ export { INPUT_METHOD }
1099
1083
  export type InsertBlockInputMethodToolbar = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.TOOLBAR;
1100
1084
 
1101
1085
  // @public (undocumented)
1102
- export function insertBlockType(name: string): Command;
1086
+ export function insertBlockType(name: string): Command_2;
1103
1087
 
1104
1088
  // @public (undocumented)
1105
1089
  export const insertBlockTypesWithAnalytics: (name: string, inputMethod: BlockTypeInputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command_2;
@@ -1281,7 +1265,7 @@ export const mediaPlugin: NextEditorPlugin<'media', {
1281
1265
  typeof widthPlugin,
1282
1266
  typeof decorationsPlugin,
1283
1267
  FloatingToolbarPlugin,
1284
- typeof editorDisabledPlugin
1268
+ EditorDisabledPlugin
1285
1269
  ];
1286
1270
  sharedState: MediaPluginState | null;
1287
1271
  }>;
@@ -1471,16 +1455,6 @@ export { MentionProvider }
1471
1455
 
1472
1456
  export { MentionResource }
1473
1457
 
1474
- // @public (undocumented)
1475
- interface MessageDescriptor {
1476
- // (undocumented)
1477
- defaultMessage: string;
1478
- // (undocumented)
1479
- description: string;
1480
- // (undocumented)
1481
- id: string;
1482
- }
1483
-
1484
1458
  export { messages }
1485
1459
 
1486
1460
  // @public (undocumented)
@@ -1825,10 +1799,10 @@ interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
1825
1799
  export { SelectOption }
1826
1800
 
1827
1801
  // @public (undocumented)
1828
- export function setBlockType(name: string): Command;
1802
+ export function setBlockType(name: string): Command_2;
1829
1803
 
1830
1804
  // @public (undocumented)
1831
- export function setBlockTypeWithAnalytics(name: string, inputMethod: BlockTypeInputMethod): Command;
1805
+ export function setBlockTypeWithAnalytics(name: string, inputMethod: BlockTypeInputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command_2;
1832
1806
 
1833
1807
  // @public (undocumented)
1834
1808
  export const setIsExpanded: (isExpanded: boolean) => Command_2;
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createPlugin = createPlugin;
7
- exports.pluginKey = exports.default = void 0;
8
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
- var _state = require("@atlaskit/editor-prosemirror/state");
10
- var _pluginStateFactory = require("../../utils/plugin-state-factory");
11
- var pluginKey = new _state.PluginKey('editorDisabledPlugin');
12
- exports.pluginKey = pluginKey;
13
- function reducer(_pluginState, meta) {
14
- return meta;
15
- }
16
- var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(pluginKey, reducer),
17
- createPluginState = _pluginFactory.createPluginState,
18
- getPluginState = _pluginFactory.getPluginState;
19
-
20
- /*
21
- Stores the state of the editor enabled/disabled for panel and floating
22
- toolbar to subscribe to through <WithPluginState>. Otherwise the NodeViews
23
- won't re-render when it changes.
24
- */
25
- function createPlugin(dispatch) {
26
- return new _safePlugin.SafePlugin({
27
- key: pluginKey,
28
- state: createPluginState(dispatch, {
29
- editorDisabled: false
30
- }),
31
- view: function view() {
32
- return {
33
- update: function update(view) {
34
- if (getPluginState(view.state).editorDisabled !== !view.editable) {
35
- var tr = view.state.tr.setMeta(pluginKey, {
36
- editorDisabled: !view.editable
37
- });
38
- tr.setMeta('isLocal', true);
39
- view.dispatch(tr);
40
- }
41
- }
42
- };
43
- }
44
- });
45
- }
46
- var editorDisabledPlugin = function editorDisabledPlugin() {
47
- return {
48
- name: 'editorDisabled',
49
- getSharedState: function getSharedState(editorState) {
50
- if (!editorState) {
51
- return {
52
- editorDisabled: false
53
- };
54
- }
55
- var pluginState = pluginKey.getState(editorState);
56
- if (!pluginState) {
57
- return {
58
- editorDisabled: false
59
- };
60
- }
61
- return pluginState;
62
- },
63
- pmPlugins: function pmPlugins() {
64
- return [{
65
- name: 'editorDisabled',
66
- plugin: function plugin(_ref) {
67
- var dispatch = _ref.dispatch;
68
- return createPlugin(dispatch);
69
- }
70
- }];
71
- }
72
- };
73
- };
74
- var _default = editorDisabledPlugin;
75
- exports.default = _default;
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.keymap = keymap;
7
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _keymap = require("@atlaskit/editor-prosemirror/keymap");
9
- var _w3cKeyname = require("w3c-keyname");
10
- /**
11
- * A workaround for mostly Cyrillic but should have a positive affect
12
- * on other languages / layouts. Attempts a similar approach to OS X.
13
- * @see ED-7310
14
- * @see https://github.com/ProseMirror/prosemirror/issues/957
15
- * @param bindings
16
- */
17
- function keymap(bindings) {
18
- return new _safePlugin.SafePlugin({
19
- props: {
20
- handleKeyDown: function handleKeyDown(view, event) {
21
- var name = (0, _w3cKeyname.keyName)(event);
22
- var keyboardEvent = event;
23
- if (event.ctrlKey && name.length === 1 &&
24
- // Check the unicode of the character to
25
- // assert that its not an ASCII character.
26
- // These are characters outside Latin's range.
27
- /[^\u0000-\u007f]/.test(name)) {
28
- keyboardEvent = new KeyboardEvent('keydown', {
29
- key: _w3cKeyname.base[event.keyCode],
30
- code: event.code,
31
- ctrlKey: true
32
- });
33
- }
34
- return (0, _keymap.keydownHandler)(bindings)(view, keyboardEvent);
35
- }
36
- }
37
- });
38
- }
@@ -1,62 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { pluginFactory } from '../../utils/plugin-state-factory';
4
- export const pluginKey = new PluginKey('editorDisabledPlugin');
5
- function reducer(_pluginState, meta) {
6
- return meta;
7
- }
8
- const {
9
- createPluginState,
10
- getPluginState
11
- } = pluginFactory(pluginKey, reducer);
12
-
13
- /*
14
- Stores the state of the editor enabled/disabled for panel and floating
15
- toolbar to subscribe to through <WithPluginState>. Otherwise the NodeViews
16
- won't re-render when it changes.
17
- */
18
- export function createPlugin(dispatch) {
19
- return new SafePlugin({
20
- key: pluginKey,
21
- state: createPluginState(dispatch, {
22
- editorDisabled: false
23
- }),
24
- view: () => {
25
- return {
26
- update(view) {
27
- if (getPluginState(view.state).editorDisabled !== !view.editable) {
28
- const tr = view.state.tr.setMeta(pluginKey, {
29
- editorDisabled: !view.editable
30
- });
31
- tr.setMeta('isLocal', true);
32
- view.dispatch(tr);
33
- }
34
- }
35
- };
36
- }
37
- });
38
- }
39
- const editorDisabledPlugin = () => ({
40
- name: 'editorDisabled',
41
- getSharedState(editorState) {
42
- if (!editorState) {
43
- return {
44
- editorDisabled: false
45
- };
46
- }
47
- const pluginState = pluginKey.getState(editorState);
48
- if (!pluginState) {
49
- return {
50
- editorDisabled: false
51
- };
52
- }
53
- return pluginState;
54
- },
55
- pmPlugins: () => [{
56
- name: 'editorDisabled',
57
- plugin: ({
58
- dispatch
59
- }) => createPlugin(dispatch)
60
- }]
61
- });
62
- export default editorDisabledPlugin;
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
3
- import { base, keyName } from 'w3c-keyname';
4
-
5
- /**
6
- * A workaround for mostly Cyrillic but should have a positive affect
7
- * on other languages / layouts. Attempts a similar approach to OS X.
8
- * @see ED-7310
9
- * @see https://github.com/ProseMirror/prosemirror/issues/957
10
- * @param bindings
11
- */
12
- export function keymap(bindings) {
13
- return new SafePlugin({
14
- props: {
15
- handleKeyDown(view, event) {
16
- const name = keyName(event);
17
- let keyboardEvent = event;
18
- if (event.ctrlKey && name.length === 1 &&
19
- // Check the unicode of the character to
20
- // assert that its not an ASCII character.
21
- // These are characters outside Latin's range.
22
- /[^\u0000-\u007f]/.test(name)) {
23
- keyboardEvent = new KeyboardEvent('keydown', {
24
- key: base[event.keyCode],
25
- code: event.code,
26
- ctrlKey: true
27
- });
28
- }
29
- return keydownHandler(bindings)(view, keyboardEvent);
30
- }
31
- }
32
- });
33
- }
@@ -1,66 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { pluginFactory } from '../../utils/plugin-state-factory';
4
- export var pluginKey = new PluginKey('editorDisabledPlugin');
5
- function reducer(_pluginState, meta) {
6
- return meta;
7
- }
8
- var _pluginFactory = pluginFactory(pluginKey, reducer),
9
- createPluginState = _pluginFactory.createPluginState,
10
- getPluginState = _pluginFactory.getPluginState;
11
-
12
- /*
13
- Stores the state of the editor enabled/disabled for panel and floating
14
- toolbar to subscribe to through <WithPluginState>. Otherwise the NodeViews
15
- won't re-render when it changes.
16
- */
17
- export function createPlugin(dispatch) {
18
- return new SafePlugin({
19
- key: pluginKey,
20
- state: createPluginState(dispatch, {
21
- editorDisabled: false
22
- }),
23
- view: function view() {
24
- return {
25
- update: function update(view) {
26
- if (getPluginState(view.state).editorDisabled !== !view.editable) {
27
- var tr = view.state.tr.setMeta(pluginKey, {
28
- editorDisabled: !view.editable
29
- });
30
- tr.setMeta('isLocal', true);
31
- view.dispatch(tr);
32
- }
33
- }
34
- };
35
- }
36
- });
37
- }
38
- var editorDisabledPlugin = function editorDisabledPlugin() {
39
- return {
40
- name: 'editorDisabled',
41
- getSharedState: function getSharedState(editorState) {
42
- if (!editorState) {
43
- return {
44
- editorDisabled: false
45
- };
46
- }
47
- var pluginState = pluginKey.getState(editorState);
48
- if (!pluginState) {
49
- return {
50
- editorDisabled: false
51
- };
52
- }
53
- return pluginState;
54
- },
55
- pmPlugins: function pmPlugins() {
56
- return [{
57
- name: 'editorDisabled',
58
- plugin: function plugin(_ref) {
59
- var dispatch = _ref.dispatch;
60
- return createPlugin(dispatch);
61
- }
62
- }];
63
- }
64
- };
65
- };
66
- export default editorDisabledPlugin;
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
3
- import { base, keyName } from 'w3c-keyname';
4
-
5
- /**
6
- * A workaround for mostly Cyrillic but should have a positive affect
7
- * on other languages / layouts. Attempts a similar approach to OS X.
8
- * @see ED-7310
9
- * @see https://github.com/ProseMirror/prosemirror/issues/957
10
- * @param bindings
11
- */
12
- export function keymap(bindings) {
13
- return new SafePlugin({
14
- props: {
15
- handleKeyDown: function handleKeyDown(view, event) {
16
- var name = keyName(event);
17
- var keyboardEvent = event;
18
- if (event.ctrlKey && name.length === 1 &&
19
- // Check the unicode of the character to
20
- // assert that its not an ASCII character.
21
- // These are characters outside Latin's range.
22
- /[^\u0000-\u007f]/.test(name)) {
23
- keyboardEvent = new KeyboardEvent('keydown', {
24
- key: base[event.keyCode],
25
- code: event.code,
26
- ctrlKey: true
27
- });
28
- }
29
- return keydownHandler(bindings)(view, keyboardEvent);
30
- }
31
- }
32
- });
33
- }
@@ -1,13 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- import type { Dispatch } from '../../event-dispatcher';
5
- export type EditorDisabledPluginState = {
6
- editorDisabled: boolean;
7
- };
8
- export declare const pluginKey: PluginKey<EditorDisabledPluginState>;
9
- export declare function createPlugin(dispatch: Dispatch<EditorDisabledPluginState>): SafePlugin | undefined;
10
- declare const editorDisabledPlugin: NextEditorPlugin<'editorDisabled', {
11
- sharedState: EditorDisabledPluginState;
12
- }>;
13
- export default editorDisabledPlugin;
@@ -1 +0,0 @@
1
- export type AllowedBlockTypes = 'heading' | 'blockquote' | 'hardBreak' | 'codeBlock';
@@ -1,11 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- /**
3
- * A workaround for mostly Cyrillic but should have a positive affect
4
- * on other languages / layouts. Attempts a similar approach to OS X.
5
- * @see ED-7310
6
- * @see https://github.com/ProseMirror/prosemirror/issues/957
7
- * @param bindings
8
- */
9
- export declare function keymap(bindings: {
10
- [key: string]: any;
11
- }): SafePlugin<any>;
@@ -1,13 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- import type { Dispatch } from '../../event-dispatcher';
5
- export type EditorDisabledPluginState = {
6
- editorDisabled: boolean;
7
- };
8
- export declare const pluginKey: PluginKey<EditorDisabledPluginState>;
9
- export declare function createPlugin(dispatch: Dispatch<EditorDisabledPluginState>): SafePlugin | undefined;
10
- declare const editorDisabledPlugin: NextEditorPlugin<'editorDisabled', {
11
- sharedState: EditorDisabledPluginState;
12
- }>;
13
- export default editorDisabledPlugin;
@@ -1 +0,0 @@
1
- export type AllowedBlockTypes = 'heading' | 'blockquote' | 'hardBreak' | 'codeBlock';
@@ -1,11 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- /**
3
- * A workaround for mostly Cyrillic but should have a positive affect
4
- * on other languages / layouts. Attempts a similar approach to OS X.
5
- * @see ED-7310
6
- * @see https://github.com/ProseMirror/prosemirror/issues/957
7
- * @param bindings
8
- */
9
- export declare function keymap(bindings: {
10
- [key: string]: any;
11
- }): SafePlugin<any>;