@atlaskit/editor-core 189.1.12 → 189.1.13

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 (95) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/index.js +0 -7
  3. package/dist/cjs/plugins/insert-block/index.js +6 -10
  4. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -38
  5. package/dist/cjs/presets/universal.js +2 -1
  6. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/es2019/plugins/index.js +0 -1
  9. package/dist/es2019/plugins/insert-block/index.js +5 -9
  10. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +4 -3
  11. package/dist/es2019/presets/universal.js +2 -1
  12. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  13. package/dist/es2019/version-wrapper.js +1 -1
  14. package/dist/esm/plugins/index.js +0 -1
  15. package/dist/esm/plugins/insert-block/index.js +5 -9
  16. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -38
  17. package/dist/esm/presets/universal.js +2 -1
  18. package/dist/esm/ui/ContentStyles/index.js +1 -1
  19. package/dist/esm/version-wrapper.js +1 -1
  20. package/dist/types/plugins/index.d.ts +0 -1
  21. package/dist/types/plugins/insert-block/types.d.ts +3 -1
  22. package/dist/types/types/editor-props.d.ts +1 -1
  23. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  24. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  25. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
  26. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  27. package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  28. package/package.json +3 -2
  29. package/report.api.md +1 -6
  30. package/tmp/api-report-tmp.d.ts +1 -6
  31. package/dist/cjs/plugins/placeholder-text/actions.js +0 -35
  32. package/dist/cjs/plugins/placeholder-text/fake-text-cursor/cursor.js +0 -107
  33. package/dist/cjs/plugins/placeholder-text/index.js +0 -20
  34. package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +0 -89
  35. package/dist/cjs/plugins/placeholder-text/plugin-key.js +0 -8
  36. package/dist/cjs/plugins/placeholder-text/plugin.js +0 -267
  37. package/dist/cjs/plugins/placeholder-text/selection-utils.js +0 -14
  38. package/dist/cjs/plugins/placeholder-text/styles.js +0 -13
  39. package/dist/cjs/plugins/placeholder-text/types.js +0 -5
  40. package/dist/cjs/plugins/placeholder-text/ui/FloatingToolbar/index.js +0 -86
  41. package/dist/cjs/plugins/placeholder-text/ui/FloatingToolbar/styles.js +0 -15
  42. package/dist/cjs/plugins/placeholder-text/ui/FloatingToolbar/utils.js +0 -54
  43. package/dist/cjs/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +0 -89
  44. package/dist/es2019/plugins/placeholder-text/actions.js +0 -27
  45. package/dist/es2019/plugins/placeholder-text/fake-text-cursor/cursor.js +0 -77
  46. package/dist/es2019/plugins/placeholder-text/index.js +0 -2
  47. package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +0 -77
  48. package/dist/es2019/plugins/placeholder-text/plugin-key.js +0 -2
  49. package/dist/es2019/plugins/placeholder-text/plugin.js +0 -247
  50. package/dist/es2019/plugins/placeholder-text/selection-utils.js +0 -8
  51. package/dist/es2019/plugins/placeholder-text/styles.js +0 -52
  52. package/dist/es2019/plugins/placeholder-text/types.js +0 -1
  53. package/dist/es2019/plugins/placeholder-text/ui/FloatingToolbar/index.js +0 -45
  54. package/dist/es2019/plugins/placeholder-text/ui/FloatingToolbar/styles.js +0 -15
  55. package/dist/es2019/plugins/placeholder-text/ui/FloatingToolbar/utils.js +0 -41
  56. package/dist/es2019/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +0 -60
  57. package/dist/esm/plugins/placeholder-text/actions.js +0 -29
  58. package/dist/esm/plugins/placeholder-text/fake-text-cursor/cursor.js +0 -100
  59. package/dist/esm/plugins/placeholder-text/index.js +0 -2
  60. package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +0 -82
  61. package/dist/esm/plugins/placeholder-text/plugin-key.js +0 -2
  62. package/dist/esm/plugins/placeholder-text/plugin.js +0 -259
  63. package/dist/esm/plugins/placeholder-text/selection-utils.js +0 -8
  64. package/dist/esm/plugins/placeholder-text/styles.js +0 -6
  65. package/dist/esm/plugins/placeholder-text/types.js +0 -1
  66. package/dist/esm/plugins/placeholder-text/ui/FloatingToolbar/index.js +0 -63
  67. package/dist/esm/plugins/placeholder-text/ui/FloatingToolbar/styles.js +0 -8
  68. package/dist/esm/plugins/placeholder-text/ui/FloatingToolbar/utils.js +0 -48
  69. package/dist/esm/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +0 -79
  70. package/dist/types/plugins/placeholder-text/actions.d.ts +0 -4
  71. package/dist/types/plugins/placeholder-text/fake-text-cursor/cursor.d.ts +0 -30
  72. package/dist/types/plugins/placeholder-text/index.d.ts +0 -3
  73. package/dist/types/plugins/placeholder-text/placeholder-text-nodeview.d.ts +0 -17
  74. package/dist/types/plugins/placeholder-text/plugin-key.d.ts +0 -3
  75. package/dist/types/plugins/placeholder-text/plugin.d.ts +0 -7
  76. package/dist/types/plugins/placeholder-text/selection-utils.d.ts +0 -2
  77. package/dist/types/plugins/placeholder-text/styles.d.ts +0 -1
  78. package/dist/types/plugins/placeholder-text/types.d.ts +0 -18
  79. package/dist/types/plugins/placeholder-text/ui/FloatingToolbar/index.d.ts +0 -28
  80. package/dist/types/plugins/placeholder-text/ui/FloatingToolbar/styles.d.ts +0 -1
  81. package/dist/types/plugins/placeholder-text/ui/FloatingToolbar/utils.d.ts +0 -13
  82. package/dist/types/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.d.ts +0 -25
  83. package/dist/types-ts4.5/plugins/placeholder-text/actions.d.ts +0 -4
  84. package/dist/types-ts4.5/plugins/placeholder-text/fake-text-cursor/cursor.d.ts +0 -30
  85. package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +0 -3
  86. package/dist/types-ts4.5/plugins/placeholder-text/placeholder-text-nodeview.d.ts +0 -17
  87. package/dist/types-ts4.5/plugins/placeholder-text/plugin-key.d.ts +0 -3
  88. package/dist/types-ts4.5/plugins/placeholder-text/plugin.d.ts +0 -7
  89. package/dist/types-ts4.5/plugins/placeholder-text/selection-utils.d.ts +0 -2
  90. package/dist/types-ts4.5/plugins/placeholder-text/styles.d.ts +0 -1
  91. package/dist/types-ts4.5/plugins/placeholder-text/types.d.ts +0 -18
  92. package/dist/types-ts4.5/plugins/placeholder-text/ui/FloatingToolbar/index.d.ts +0 -28
  93. package/dist/types-ts4.5/plugins/placeholder-text/ui/FloatingToolbar/styles.d.ts +0 -1
  94. package/dist/types-ts4.5/plugins/placeholder-text/ui/FloatingToolbar/utils.d.ts +0 -13
  95. package/dist/types-ts4.5/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.d.ts +0 -25
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.1.12";
2
+ export var version = "189.1.13";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -9,7 +9,6 @@ export { default as macroPlugin } from './macro';
9
9
  export { default as maxContentSizePlugin } from './max-content-size';
10
10
  export { default as panelPlugin } from './panel';
11
11
  export { default as pastePlugin } from './paste';
12
- export { placeholderTextPlugin } from './placeholder-text';
13
12
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
14
13
  export { default as breakoutPlugin } from './breakout';
15
14
  export { default as alignmentPlugin } from './alignment';
@@ -16,6 +16,7 @@ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
16
16
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
17
17
  import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
18
18
  import type { StatusPlugin } from '@atlaskit/editor-plugin-status';
19
+ import type { PlaceholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
19
20
  import type { ExpandPlugin } from '../expand';
20
21
  export type InsertBlockPluginDependencies = [
21
22
  FeatureFlagsPlugin,
@@ -35,5 +36,6 @@ export type InsertBlockPluginDependencies = [
35
36
  OptionalPlugin<MentionsPlugin>,
36
37
  OptionalPlugin<StatusPlugin>,
37
38
  OptionalPlugin<LayoutPlugin>,
38
- OptionalPlugin<ExpandPlugin>
39
+ OptionalPlugin<ExpandPlugin>,
40
+ OptionalPlugin<PlaceholderTextPlugin>
39
41
  ];
@@ -22,7 +22,7 @@ import type { LayoutPluginOptions } from '@atlaskit/editor-plugin-layout';
22
22
  import type { MediaOptions, MediaState } from '@atlaskit/editor-plugin-media/types';
23
23
  import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
24
24
  import type { PanelPluginConfig } from '../plugins/panel/types';
25
- import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
25
+ import type { PlaceholderTextOptions } from '@atlaskit/editor-plugin-placeholder-text';
26
26
  import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color';
27
27
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
28
28
  import type { EditorAppearance } from './editor-appearance';
@@ -17,5 +17,5 @@ type Props = {
17
17
  isLoading?: boolean;
18
18
  featureFlags?: FeatureFlags;
19
19
  } & WithAnalyticsEventsProps;
20
- declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "autoSaveReject" | "onChange" | "isLoading" | "fields" | "key" | "parameters" | "featureFlags" | "onCancel" | "autoSave" | "analyticsContext" | "errorMessage" | "extensionManifest" | "autoSaveTrigger" | "showHeader" | "closeOnEsc"> & React.RefAttributes<any>>;
20
+ declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "autoSaveReject" | "onChange" | "isLoading" | "fields" | "key" | "parameters" | "onCancel" | "featureFlags" | "autoSave" | "analyticsContext" | "errorMessage" | "extensionManifest" | "autoSaveTrigger" | "showHeader" | "closeOnEsc"> & React.RefAttributes<any>>;
21
21
  export default _default;
@@ -9,7 +9,6 @@ export { default as macroPlugin } from './macro';
9
9
  export { default as maxContentSizePlugin } from './max-content-size';
10
10
  export { default as panelPlugin } from './panel';
11
11
  export { default as pastePlugin } from './paste';
12
- export { placeholderTextPlugin } from './placeholder-text';
13
12
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
14
13
  export { default as breakoutPlugin } from './breakout';
15
14
  export { default as alignmentPlugin } from './alignment';
@@ -16,6 +16,7 @@ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
16
16
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
17
17
  import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
18
18
  import type { StatusPlugin } from '@atlaskit/editor-plugin-status';
19
+ import type { PlaceholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
19
20
  import type { ExpandPlugin } from '../expand';
20
21
  export type InsertBlockPluginDependencies = [
21
22
  FeatureFlagsPlugin,
@@ -35,5 +36,6 @@ export type InsertBlockPluginDependencies = [
35
36
  OptionalPlugin<MentionsPlugin>,
36
37
  OptionalPlugin<StatusPlugin>,
37
38
  OptionalPlugin<LayoutPlugin>,
38
- OptionalPlugin<ExpandPlugin>
39
+ OptionalPlugin<ExpandPlugin>,
40
+ OptionalPlugin<PlaceholderTextPlugin>
39
41
  ];
@@ -22,7 +22,7 @@ import type { LayoutPluginOptions } from '@atlaskit/editor-plugin-layout';
22
22
  import type { MediaOptions, MediaState } from '@atlaskit/editor-plugin-media/types';
23
23
  import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
24
24
  import type { PanelPluginConfig } from '../plugins/panel/types';
25
- import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
25
+ import type { PlaceholderTextOptions } from '@atlaskit/editor-plugin-placeholder-text';
26
26
  import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color';
27
27
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
28
28
  import type { EditorAppearance } from './editor-appearance';
@@ -17,5 +17,5 @@ type Props = {
17
17
  isLoading?: boolean;
18
18
  featureFlags?: FeatureFlags;
19
19
  } & WithAnalyticsEventsProps;
20
- declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "autoSaveReject" | "onChange" | "isLoading" | "fields" | "key" | "parameters" | "featureFlags" | "onCancel" | "autoSave" | "analyticsContext" | "errorMessage" | "extensionManifest" | "autoSaveTrigger" | "showHeader" | "closeOnEsc"> & React.RefAttributes<any>>;
20
+ declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "autoSaveReject" | "onChange" | "isLoading" | "fields" | "key" | "parameters" | "onCancel" | "featureFlags" | "autoSave" | "analyticsContext" | "errorMessage" | "extensionManifest" | "autoSaveTrigger" | "showHeader" | "closeOnEsc"> & React.RefAttributes<any>>;
21
21
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "189.1.12",
3
+ "version": "189.1.13",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/code": "^14.6.0",
54
54
  "@atlaskit/date": "^0.10.0",
55
55
  "@atlaskit/datetime-picker": "^12.10.0",
56
- "@atlaskit/editor-common": "^76.17.0",
56
+ "@atlaskit/editor-common": "^76.18.0",
57
57
  "@atlaskit/editor-json-transformer": "^8.10.0",
58
58
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
59
59
  "@atlaskit/editor-palette": "1.5.1",
@@ -91,6 +91,7 @@
91
91
  "@atlaskit/editor-plugin-paste": "^0.1.0",
92
92
  "@atlaskit/editor-plugin-paste-options-toolbar": "^0.2.0",
93
93
  "@atlaskit/editor-plugin-placeholder": "^0.1.0",
94
+ "@atlaskit/editor-plugin-placeholder-text": "^0.1.0",
94
95
  "@atlaskit/editor-plugin-quick-insert": "^0.2.0",
95
96
  "@atlaskit/editor-plugin-rule": "^0.1.0",
96
97
  "@atlaskit/editor-plugin-save-on-enter": "^0.1.0",
package/report.api.md CHANGED
@@ -63,6 +63,7 @@ import { MentionResource } from '@atlaskit/mention/resource';
63
63
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
64
64
  import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
65
65
  import { PerformanceTracking } from '@atlaskit/editor-common/types';
66
+ import type { PlaceholderTextOptions } from '@atlaskit/editor-plugin-placeholder-text';
66
67
  import type { PluginConfig } from '@atlaskit/editor-plugin-table/types';
67
68
  import { PortalProvider } from '@atlaskit/editor-common/portal-provider';
68
69
  import { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
@@ -670,12 +671,6 @@ interface PanelPluginConfig {
670
671
  allowCustomPanelEdit?: boolean;
671
672
  }
672
673
 
673
- // @public (undocumented)
674
- interface PlaceholderTextOptions {
675
- // (undocumented)
676
- allowInserting?: boolean;
677
- }
678
-
679
674
  export { PortalProvider };
680
675
 
681
676
  export { PortalProviderAPI };
@@ -52,6 +52,7 @@ import { MentionResource } from '@atlaskit/mention/resource';
52
52
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
53
53
  import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
54
54
  import { PerformanceTracking } from '@atlaskit/editor-common/types';
55
+ import type { PlaceholderTextOptions } from '@atlaskit/editor-plugin-placeholder-text';
55
56
  import type { PluginConfig } from '@atlaskit/editor-plugin-table/types';
56
57
  import { PortalProvider } from '@atlaskit/editor-common/portal-provider';
57
58
  import { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
@@ -618,12 +619,6 @@ interface PanelPluginConfig {
618
619
  allowCustomPanelEdit?: boolean;
619
620
  }
620
621
 
621
- // @public (undocumented)
622
- interface PlaceholderTextOptions {
623
- // (undocumented)
624
- allowInserting?: boolean;
625
- }
626
-
627
622
  export { PortalProvider }
628
623
 
629
624
  export { PortalProviderAPI }
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.showPlaceholderFloatingToolbar = exports.insertPlaceholderTextAtSelection = exports.hidePlaceholderFloatingToolbar = void 0;
7
- var _pluginKey = require("./plugin-key");
8
- var showPlaceholderFloatingToolbar = exports.showPlaceholderFloatingToolbar = function showPlaceholderFloatingToolbar(state, dispatch) {
9
- var tr = state.tr;
10
- if (!state.selection.empty) {
11
- tr.deleteSelection();
12
- }
13
- tr.setMeta(_pluginKey.pluginKey, {
14
- showInsertPanelAt: tr.selection.anchor
15
- });
16
- tr.scrollIntoView();
17
- dispatch(tr);
18
- return true;
19
- };
20
- var insertPlaceholderTextAtSelection = exports.insertPlaceholderTextAtSelection = function insertPlaceholderTextAtSelection(value) {
21
- return function (state, dispatch) {
22
- dispatch(state.tr.replaceSelectionWith(state.schema.nodes.placeholder.createChecked({
23
- text: value
24
- })).setMeta(_pluginKey.pluginKey, {
25
- showInsertPanelAt: null
26
- }).scrollIntoView());
27
- return true;
28
- };
29
- };
30
- var hidePlaceholderFloatingToolbar = exports.hidePlaceholderFloatingToolbar = function hidePlaceholderFloatingToolbar(state, dispatch) {
31
- dispatch(state.tr.setMeta(_pluginKey.pluginKey, {
32
- showInsertPanelAt: null
33
- }));
34
- return true;
35
- };
@@ -1,107 +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.removeFakeTextCursor = exports.drawFakeTextCursor = exports.addFakeTextCursor = exports.FakeTextCursorSelection = exports.FakeTextCursorBookmark = void 0;
8
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
9
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
10
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _state = require("@atlaskit/editor-prosemirror/state");
15
- var _view = require("@atlaskit/editor-prosemirror/view");
16
- var _model = require("@atlaskit/editor-prosemirror/model");
17
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
- var FakeTextCursorBookmark = exports.FakeTextCursorBookmark = /*#__PURE__*/function () {
20
- function FakeTextCursorBookmark(pos) {
21
- (0, _classCallCheck2.default)(this, FakeTextCursorBookmark);
22
- (0, _defineProperty2.default)(this, "pos", undefined);
23
- (0, _defineProperty2.default)(this, "visible", false);
24
- this.pos = pos;
25
- }
26
- (0, _createClass2.default)(FakeTextCursorBookmark, [{
27
- key: "map",
28
- value: function map(mapping) {
29
- return new FakeTextCursorBookmark(mapping.map(this.pos));
30
- }
31
- }, {
32
- key: "resolve",
33
- value: function resolve(doc) {
34
- var $pos = doc.resolve(this.pos);
35
- return _state.Selection.near($pos);
36
- }
37
- }]);
38
- return FakeTextCursorBookmark;
39
- }();
40
- var FakeTextCursorSelection = exports.FakeTextCursorSelection = /*#__PURE__*/function (_Selection) {
41
- (0, _inherits2.default)(FakeTextCursorSelection, _Selection);
42
- var _super = _createSuper(FakeTextCursorSelection);
43
- function FakeTextCursorSelection($pos) {
44
- (0, _classCallCheck2.default)(this, FakeTextCursorSelection);
45
- return _super.call(this, $pos, $pos);
46
- }
47
- (0, _createClass2.default)(FakeTextCursorSelection, [{
48
- key: "map",
49
- value: function map(doc, mapping) {
50
- var $pos = doc.resolve(mapping.map(this.$head.pos));
51
- return new FakeTextCursorSelection($pos);
52
- }
53
- }, {
54
- key: "eq",
55
- value: function eq(other) {
56
- return other instanceof FakeTextCursorSelection && other.head === this.head;
57
- }
58
- }, {
59
- key: "toJSON",
60
- value: function toJSON() {
61
- return {
62
- type: 'Cursor',
63
- pos: this.head
64
- };
65
- }
66
- }, {
67
- key: "getBookmark",
68
- value: function getBookmark() {
69
- return new FakeTextCursorBookmark(this.anchor);
70
- }
71
- }], [{
72
- key: "content",
73
- value: function content() {
74
- return _model.Slice.empty;
75
- }
76
- }, {
77
- key: "fromJSON",
78
- value: function fromJSON(doc, json) {
79
- return new FakeTextCursorSelection(doc.resolve(json.pos));
80
- }
81
- }]);
82
- return FakeTextCursorSelection;
83
- }(_state.Selection);
84
- _state.Selection.jsonID('fake-text-cursor', FakeTextCursorSelection);
85
- var addFakeTextCursor = exports.addFakeTextCursor = function addFakeTextCursor(state, dispatch) {
86
- var selection = state.selection;
87
- if (selection.empty) {
88
- var $from = state.selection.$from;
89
- dispatch(state.tr.setSelection(new FakeTextCursorSelection($from)));
90
- }
91
- };
92
- var removeFakeTextCursor = exports.removeFakeTextCursor = function removeFakeTextCursor(state, dispatch) {
93
- if (state.selection instanceof FakeTextCursorSelection) {
94
- var $from = state.selection.$from;
95
- dispatch(state.tr.setSelection(new _state.TextSelection($from)));
96
- }
97
- };
98
- var drawFakeTextCursor = exports.drawFakeTextCursor = function drawFakeTextCursor(state) {
99
- if (!(state.selection instanceof FakeTextCursorSelection)) {
100
- return null;
101
- }
102
- var node = document.createElement('div');
103
- node.className = 'ProseMirror-fake-text-cursor';
104
- return _view.DecorationSet.create(state.doc, [_view.Decoration.widget(state.selection.head, node, {
105
- key: 'Cursor'
106
- })]);
107
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "FakeTextCursorSelection", {
8
- enumerable: true,
9
- get: function get() {
10
- return _cursor.FakeTextCursorSelection;
11
- }
12
- });
13
- Object.defineProperty(exports, "placeholderTextPlugin", {
14
- enumerable: true,
15
- get: function get() {
16
- return _plugin.default;
17
- }
18
- });
19
- var _plugin = _interopRequireDefault(require("./plugin"));
20
- var _cursor = require("./fake-text-cursor/cursor");
@@ -1,89 +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.PlaceholderTextNodeView = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _state = require("@atlaskit/editor-prosemirror/state");
11
- var _utils = require("@atlaskit/editor-common/utils");
12
- var serializePlaceholderNode = function serializePlaceholderNode(node) {
13
- var element = document.createElement('span');
14
- element.classList.add('pm-placeholder');
15
-
16
- // the inline node api test suite requires the following class name
17
- element.classList.add('placeholderView-content-wrap');
18
- element.innerText = _utils.ZERO_WIDTH_SPACE;
19
- var elementChildren = document.createElement('span');
20
- elementChildren.classList.add('pm-placeholder__text');
21
- elementChildren.dataset.placeholder = node.attrs.text;
22
- elementChildren.setAttribute('contenteditable', 'false');
23
- element.appendChild(elementChildren);
24
- if (_utils.browser.safari) {
25
- element.appendChild(document.createTextNode(_utils.ZERO_WIDTH_SPACE));
26
- } else {
27
- element.appendChild(document.createElement('wbr'));
28
- }
29
- return element;
30
- };
31
- var PlaceholderTextNodeView = exports.PlaceholderTextNodeView = /*#__PURE__*/function () {
32
- function PlaceholderTextNodeView(node, view, getPos) {
33
- (0, _classCallCheck2.default)(this, PlaceholderTextNodeView);
34
- this.node = node;
35
- this.view = view;
36
- this.getPos = getPos;
37
- this.dom = serializePlaceholderNode(this.node);
38
- this.getPos = getPos;
39
- }
40
- (0, _createClass2.default)(PlaceholderTextNodeView, [{
41
- key: "stopEvent",
42
- value: function stopEvent(e) {
43
- if (e.type === 'mousedown' && typeof this.getPos === 'function') {
44
- e.preventDefault();
45
- var _view = this.view;
46
- var startNodePosition = this.getPos();
47
- if (typeof startNodePosition !== 'number') {
48
- return false;
49
- }
50
- var tr = _view.state.tr;
51
- tr.setSelection(_state.Selection.near(tr.doc.resolve(startNodePosition)));
52
- _view.dispatch(tr);
53
- return true;
54
- }
55
- return false;
56
- }
57
- }, {
58
- key: "ignoreMutation",
59
- value: function ignoreMutation(record) {
60
- if (typeof this.getPos !== 'function' || record.type !== 'selection') {
61
- return true;
62
- }
63
- var view = this.view,
64
- node = this.node;
65
- var placeholderStartPosition = this.getPos();
66
- if (typeof placeholderStartPosition !== 'number') {
67
- return false;
68
- }
69
- var placeholderEndPosition = placeholderStartPosition + node.nodeSize;
70
- var selection = view.state.selection;
71
-
72
- // when the selection is set right after the placeholder.
73
- // we should let ProseMirror deal with this edge-case
74
- if (selection.from === placeholderEndPosition) {
75
- return false;
76
- }
77
- var isSelectionAtPlaceholder = selection.from === placeholderStartPosition;
78
- var isSelectionAfterlaceholder = selection.from > placeholderEndPosition;
79
- if (isSelectionAtPlaceholder || isSelectionAfterlaceholder) {
80
- var tr = view.state.tr;
81
- tr.setSelection(_state.Selection.near(tr.doc.resolve(placeholderEndPosition)));
82
- view.dispatch(tr);
83
- return true;
84
- }
85
- return true;
86
- }
87
- }]);
88
- return PlaceholderTextNodeView;
89
- }();
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.pluginKey = void 0;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var pluginKey = exports.pluginKey = new _state.PluginKey('placeholderTextPlugin');