@atlaskit/editor-plugin-placeholder 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-placeholder
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 0.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 0.1.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -27,4 +27,4 @@ Please see [Atlaskit - Editor plugin placeholder](https://atlaskit.atlassian.com
27
27
  For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
28
28
  ## License
29
29
  ---
30
- Please see [Atlassian Frontend - License](https://developer.atlassian.com/cloud/framework/atlassian-frontend/#license) for more licensing information.
30
+ Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
@@ -10,13 +10,11 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
10
  var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _view = require("@atlaskit/editor-prosemirror/view");
13
- var pluginKey = new _state.PluginKey('placeholderPlugin');
14
- exports.pluginKey = pluginKey;
13
+ var pluginKey = exports.pluginKey = new _state.PluginKey('placeholderPlugin');
15
14
  function getPlaceholderState(editorState) {
16
15
  return pluginKey.getState(editorState);
17
16
  }
18
- var placeholderTestId = 'placeholder-test-id';
19
- exports.placeholderTestId = placeholderTestId;
17
+ var placeholderTestId = exports.placeholderTestId = 'placeholder-test-id';
20
18
  function createPlaceholderDecoration(editorState, placeholderText) {
21
19
  var pos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
22
20
  var placeholderDecoration = document.createElement('span');
@@ -82,13 +80,13 @@ function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api) {
82
80
  key: pluginKey,
83
81
  state: {
84
82
  init: function init(_, state) {
85
- var _api$focus, _api$focus$sharedStat;
86
- return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$focus = api.focus) === null || _api$focus === void 0 ? void 0 : (_api$focus$sharedStat = _api$focus.sharedState.currentState()) === null || _api$focus$sharedStat === void 0 ? void 0 : _api$focus$sharedStat.hasFocus), state, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
83
+ var _api$focus;
84
+ return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 || (_api$focus = api.focus) === null || _api$focus === void 0 || (_api$focus = _api$focus.sharedState.currentState()) === null || _api$focus === void 0 ? void 0 : _api$focus.hasFocus), state, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
87
85
  },
88
86
  apply: function apply(tr, _oldPluginState, _oldEditorState, newEditorState) {
89
- var _api$focus2, _api$focus2$sharedSta;
87
+ var _api$focus2;
90
88
  var meta = tr.getMeta(pluginKey);
91
- var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$focus2 = api.focus) === null || _api$focus2 === void 0 ? void 0 : (_api$focus2$sharedSta = _api$focus2.sharedState.currentState()) === null || _api$focus2$sharedSta === void 0 ? void 0 : _api$focus2$sharedSta.hasFocus);
89
+ var isEditorFocused = Boolean(api === null || api === void 0 || (_api$focus2 = api.focus) === null || _api$focus2 === void 0 || (_api$focus2 = _api$focus2.sharedState.currentState()) === null || _api$focus2 === void 0 ? void 0 : _api$focus2.hasFocus);
92
90
  if (meta) {
93
91
  if (meta.removePlaceholder) {
94
92
  return emptyPlaceholder;
@@ -107,7 +105,7 @@ function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api) {
107
105
  hasPlaceholder = _getPlaceholderState.hasPlaceholder,
108
106
  placeholderText = _getPlaceholderState.placeholderText,
109
107
  pos = _getPlaceholderState.pos;
110
- var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
108
+ var compositionPluginState = api === null || api === void 0 || (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
111
109
  if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
112
110
  return createPlaceholderDecoration(editorState, placeholderText, pos);
113
111
  }
@@ -116,7 +114,7 @@ function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api) {
116
114
  }
117
115
  });
118
116
  }
119
- var placeholderPlugin = function placeholderPlugin(_ref) {
117
+ var placeholderPlugin = exports.placeholderPlugin = function placeholderPlugin(_ref) {
120
118
  var options = _ref.config,
121
119
  api = _ref.api;
122
120
  return {
@@ -130,5 +128,4 @@ var placeholderPlugin = function placeholderPlugin(_ref) {
130
128
  }];
131
129
  }
132
130
  };
133
- };
134
- exports.placeholderPlugin = placeholderPlugin;
131
+ };
@@ -72,13 +72,13 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
72
72
  key: pluginKey,
73
73
  state: {
74
74
  init: function init(_, state) {
75
- var _api$focus, _api$focus$sharedStat;
76
- return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$focus = api.focus) === null || _api$focus === void 0 ? void 0 : (_api$focus$sharedStat = _api$focus.sharedState.currentState()) === null || _api$focus$sharedStat === void 0 ? void 0 : _api$focus$sharedStat.hasFocus), state, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
75
+ var _api$focus;
76
+ return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 || (_api$focus = api.focus) === null || _api$focus === void 0 || (_api$focus = _api$focus.sharedState.currentState()) === null || _api$focus === void 0 ? void 0 : _api$focus.hasFocus), state, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
77
77
  },
78
78
  apply: function apply(tr, _oldPluginState, _oldEditorState, newEditorState) {
79
- var _api$focus2, _api$focus2$sharedSta;
79
+ var _api$focus2;
80
80
  var meta = tr.getMeta(pluginKey);
81
- var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$focus2 = api.focus) === null || _api$focus2 === void 0 ? void 0 : (_api$focus2$sharedSta = _api$focus2.sharedState.currentState()) === null || _api$focus2$sharedSta === void 0 ? void 0 : _api$focus2$sharedSta.hasFocus);
81
+ var isEditorFocused = Boolean(api === null || api === void 0 || (_api$focus2 = api.focus) === null || _api$focus2 === void 0 || (_api$focus2 = _api$focus2.sharedState.currentState()) === null || _api$focus2 === void 0 ? void 0 : _api$focus2.hasFocus);
82
82
  if (meta) {
83
83
  if (meta.removePlaceholder) {
84
84
  return emptyPlaceholder;
@@ -97,7 +97,7 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
97
97
  hasPlaceholder = _getPlaceholderState.hasPlaceholder,
98
98
  placeholderText = _getPlaceholderState.placeholderText,
99
99
  pos = _getPlaceholderState.pos;
100
- var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
100
+ var compositionPluginState = api === null || api === void 0 || (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
101
101
  if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
102
102
  return createPlaceholderDecoration(editorState, placeholderText, pos);
103
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-placeholder",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Placeholder plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,10 +31,10 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^76.0.0",
34
+ "@atlaskit/editor-common": "^76.6.0",
35
35
  "@atlaskit/editor-plugin-composition": "^0.1.0",
36
36
  "@atlaskit/editor-plugin-focus": "^0.2.0",
37
- "@atlaskit/editor-plugin-type-ahead": "^0.3.0",
37
+ "@atlaskit/editor-plugin-type-ahead": "^0.5.0",
38
38
  "@atlaskit/editor-prosemirror": "1.1.0",
39
39
  "@babel/runtime": "^7.0.0"
40
40
  },