@atlaskit/editor-plugin-expand 1.6.8 → 1.6.9

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,14 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 1.6.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#97592](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97592)
8
+ [`97342ab324ba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/97342ab324ba) -
9
+ [ux] [ED-23114] Add functionality for undo and redo behaviour using ProseMirror while inside the
10
+ title of an expand. Previously, this was being handled by the browser default behaviour.
11
+
3
12
  ## 1.6.8
4
13
 
5
14
  ### Patch Changes
@@ -16,6 +16,7 @@ var _selection = require("@atlaskit/editor-common/selection");
16
16
  var _styles = require("@atlaskit/editor-common/styles");
17
17
  var _ui = require("@atlaskit/editor-common/ui");
18
18
  var _utils = require("@atlaskit/editor-common/utils");
19
+ var _history = require("@atlaskit/editor-prosemirror/history");
19
20
  var _model = require("@atlaskit/editor-prosemirror/model");
20
21
  var _state = require("@atlaskit/editor-prosemirror/state");
21
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -187,6 +188,16 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
187
188
  _this.deleteExpand(event);
188
189
  break;
189
190
  }
191
+ // 'Ctrl-y', 'Mod-Shift-z');
192
+ if (event.ctrlKey && event.key === 'y' || (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'z') {
193
+ _this.handleRedoFromTitle(event);
194
+ return;
195
+ }
196
+ // 'Mod-z'
197
+ if ((event.ctrlKey || event.metaKey) && event.key === 'z') {
198
+ _this.handleUndoFromTitle(event);
199
+ return;
200
+ }
190
201
  });
191
202
  (0, _defineProperty2.default)(this, "deleteExpand", function (event) {
192
203
  if (!_this.input) {
@@ -369,6 +380,22 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
369
380
  }
370
381
  }
371
382
  });
383
+ (0, _defineProperty2.default)(this, "handleUndoFromTitle", function (event) {
384
+ var _this$view10 = _this.view,
385
+ state = _this$view10.state,
386
+ dispatch = _this$view10.dispatch;
387
+ (0, _history.undo)(state, dispatch);
388
+ event.preventDefault();
389
+ return;
390
+ });
391
+ (0, _defineProperty2.default)(this, "handleRedoFromTitle", function (event) {
392
+ var _this$view11 = _this.view,
393
+ state = _this$view11.state,
394
+ dispatch = _this$view11.dispatch;
395
+ (0, _history.redo)(state, dispatch);
396
+ event.preventDefault();
397
+ return;
398
+ });
372
399
  (0, _defineProperty2.default)(this, "getContentEditable", function (node) {
373
400
  var contentEditable = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && _this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded;
374
401
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') && _this.api && _this.api.editorDisabled) {
@@ -15,6 +15,7 @@ var _expand = require("@atlaskit/editor-common/expand");
15
15
  var _selection = require("@atlaskit/editor-common/selection");
16
16
  var _styles = require("@atlaskit/editor-common/styles");
17
17
  var _utils = require("@atlaskit/editor-common/utils");
18
+ var _history = require("@atlaskit/editor-prosemirror/history");
18
19
  var _model = require("@atlaskit/editor-prosemirror/model");
19
20
  var _state = require("@atlaskit/editor-prosemirror/state");
20
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -146,6 +147,16 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
146
147
  _this.deleteEmptyExpand();
147
148
  break;
148
149
  }
150
+ // 'Ctrl-y', 'Mod-Shift-z');
151
+ if (event.ctrlKey && event.key === 'y' || (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'z') {
152
+ _this.handleRedoFromTitle(event);
153
+ return;
154
+ }
155
+ // 'Mod-z'
156
+ if ((event.ctrlKey || event.metaKey) && event.key === 'z') {
157
+ _this.handleUndoFromTitle(event);
158
+ return;
159
+ }
149
160
  });
150
161
  (0, _defineProperty2.default)(this, "deleteEmptyExpand", function () {
151
162
  var state = _this.view.state;
@@ -325,6 +336,22 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
325
336
  }
326
337
  }
327
338
  });
339
+ (0, _defineProperty2.default)(this, "handleUndoFromTitle", function (event) {
340
+ var _this$view9 = _this.view,
341
+ state = _this$view9.state,
342
+ dispatch = _this$view9.dispatch;
343
+ (0, _history.undo)(state, dispatch);
344
+ event.preventDefault();
345
+ return;
346
+ });
347
+ (0, _defineProperty2.default)(this, "handleRedoFromTitle", function (event) {
348
+ var _this$view10 = _this.view,
349
+ state = _this$view10.state,
350
+ dispatch = _this$view10.dispatch;
351
+ (0, _history.redo)(state, dispatch);
352
+ event.preventDefault();
353
+ return;
354
+ });
328
355
  (0, _defineProperty2.default)(this, "getContentEditable", function (node) {
329
356
  var contentEditable = !(0, _expand.isExpandCollapsed)(node);
330
357
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') && _this.api && _this.api.editorDisabled) {
@@ -6,6 +6,7 @@ import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor
6
6
  import { expandClassNames } from '@atlaskit/editor-common/styles';
7
7
  import { expandMessages } from '@atlaskit/editor-common/ui';
8
8
  import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
9
+ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
9
10
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
10
11
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
11
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -173,6 +174,16 @@ export class ExpandNodeView {
173
174
  this.deleteExpand(event);
174
175
  break;
175
176
  }
177
+ // 'Ctrl-y', 'Mod-Shift-z');
178
+ if (event.ctrlKey && event.key === 'y' || (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'z') {
179
+ this.handleRedoFromTitle(event);
180
+ return;
181
+ }
182
+ // 'Mod-z'
183
+ if ((event.ctrlKey || event.metaKey) && event.key === 'z') {
184
+ this.handleUndoFromTitle(event);
185
+ return;
186
+ }
176
187
  });
177
188
  _defineProperty(this, "deleteExpand", event => {
178
189
  if (!this.input) {
@@ -368,6 +379,24 @@ export class ExpandNodeView {
368
379
  }
369
380
  }
370
381
  });
382
+ _defineProperty(this, "handleUndoFromTitle", event => {
383
+ const {
384
+ state,
385
+ dispatch
386
+ } = this.view;
387
+ undo(state, dispatch);
388
+ event.preventDefault();
389
+ return;
390
+ });
391
+ _defineProperty(this, "handleRedoFromTitle", event => {
392
+ const {
393
+ state,
394
+ dispatch
395
+ } = this.view;
396
+ redo(state, dispatch);
397
+ event.preventDefault();
398
+ return;
399
+ });
371
400
  _defineProperty(this, "getContentEditable", node => {
372
401
  const contentEditable = getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded;
373
402
  if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') && this.api && this.api.editorDisabled) {
@@ -5,6 +5,7 @@ import { expandedState, isExpandCollapsed } from '@atlaskit/editor-common/expand
5
5
  import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
6
6
  import { expandClassNames } from '@atlaskit/editor-common/styles';
7
7
  import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
8
+ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
8
9
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
9
10
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
10
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -132,6 +133,16 @@ export class ExpandNodeView {
132
133
  this.deleteEmptyExpand();
133
134
  break;
134
135
  }
136
+ // 'Ctrl-y', 'Mod-Shift-z');
137
+ if (event.ctrlKey && event.key === 'y' || (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'z') {
138
+ this.handleRedoFromTitle(event);
139
+ return;
140
+ }
141
+ // 'Mod-z'
142
+ if ((event.ctrlKey || event.metaKey) && event.key === 'z') {
143
+ this.handleUndoFromTitle(event);
144
+ return;
145
+ }
135
146
  });
136
147
  _defineProperty(this, "deleteEmptyExpand", () => {
137
148
  const {
@@ -324,6 +335,24 @@ export class ExpandNodeView {
324
335
  }
325
336
  }
326
337
  });
338
+ _defineProperty(this, "handleUndoFromTitle", event => {
339
+ const {
340
+ state,
341
+ dispatch
342
+ } = this.view;
343
+ undo(state, dispatch);
344
+ event.preventDefault();
345
+ return;
346
+ });
347
+ _defineProperty(this, "handleRedoFromTitle", event => {
348
+ const {
349
+ state,
350
+ dispatch
351
+ } = this.view;
352
+ redo(state, dispatch);
353
+ event.preventDefault();
354
+ return;
355
+ });
327
356
  _defineProperty(this, "getContentEditable", node => {
328
357
  const contentEditable = !isExpandCollapsed(node);
329
358
  if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') && this.api && this.api.editorDisabled) {
@@ -8,6 +8,7 @@ import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor
8
8
  import { expandClassNames } from '@atlaskit/editor-common/styles';
9
9
  import { expandMessages } from '@atlaskit/editor-common/ui';
10
10
  import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
11
+ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
11
12
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
12
13
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
13
14
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -179,6 +180,16 @@ export var ExpandNodeView = /*#__PURE__*/function () {
179
180
  _this.deleteExpand(event);
180
181
  break;
181
182
  }
183
+ // 'Ctrl-y', 'Mod-Shift-z');
184
+ if (event.ctrlKey && event.key === 'y' || (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'z') {
185
+ _this.handleRedoFromTitle(event);
186
+ return;
187
+ }
188
+ // 'Mod-z'
189
+ if ((event.ctrlKey || event.metaKey) && event.key === 'z') {
190
+ _this.handleUndoFromTitle(event);
191
+ return;
192
+ }
182
193
  });
183
194
  _defineProperty(this, "deleteExpand", function (event) {
184
195
  if (!_this.input) {
@@ -361,6 +372,22 @@ export var ExpandNodeView = /*#__PURE__*/function () {
361
372
  }
362
373
  }
363
374
  });
375
+ _defineProperty(this, "handleUndoFromTitle", function (event) {
376
+ var _this$view10 = _this.view,
377
+ state = _this$view10.state,
378
+ dispatch = _this$view10.dispatch;
379
+ undo(state, dispatch);
380
+ event.preventDefault();
381
+ return;
382
+ });
383
+ _defineProperty(this, "handleRedoFromTitle", function (event) {
384
+ var _this$view11 = _this.view,
385
+ state = _this$view11.state,
386
+ dispatch = _this$view11.dispatch;
387
+ redo(state, dispatch);
388
+ event.preventDefault();
389
+ return;
390
+ });
364
391
  _defineProperty(this, "getContentEditable", function (node) {
365
392
  var contentEditable = getBooleanFF('platform.editor.live-pages-expand-divergence') && _this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded;
366
393
  if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') && _this.api && _this.api.editorDisabled) {
@@ -7,6 +7,7 @@ import { expandedState, isExpandCollapsed } from '@atlaskit/editor-common/expand
7
7
  import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
8
8
  import { expandClassNames } from '@atlaskit/editor-common/styles';
9
9
  import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
10
+ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
10
11
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
11
12
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
12
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -138,6 +139,16 @@ export var ExpandNodeView = /*#__PURE__*/function () {
138
139
  _this.deleteEmptyExpand();
139
140
  break;
140
141
  }
142
+ // 'Ctrl-y', 'Mod-Shift-z');
143
+ if (event.ctrlKey && event.key === 'y' || (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'z') {
144
+ _this.handleRedoFromTitle(event);
145
+ return;
146
+ }
147
+ // 'Mod-z'
148
+ if ((event.ctrlKey || event.metaKey) && event.key === 'z') {
149
+ _this.handleUndoFromTitle(event);
150
+ return;
151
+ }
141
152
  });
142
153
  _defineProperty(this, "deleteEmptyExpand", function () {
143
154
  var state = _this.view.state;
@@ -317,6 +328,22 @@ export var ExpandNodeView = /*#__PURE__*/function () {
317
328
  }
318
329
  }
319
330
  });
331
+ _defineProperty(this, "handleUndoFromTitle", function (event) {
332
+ var _this$view9 = _this.view,
333
+ state = _this$view9.state,
334
+ dispatch = _this$view9.dispatch;
335
+ undo(state, dispatch);
336
+ event.preventDefault();
337
+ return;
338
+ });
339
+ _defineProperty(this, "handleRedoFromTitle", function (event) {
340
+ var _this$view10 = _this.view,
341
+ state = _this$view10.state,
342
+ dispatch = _this$view10.dispatch;
343
+ redo(state, dispatch);
344
+ event.preventDefault();
345
+ return;
346
+ });
320
347
  _defineProperty(this, "getContentEditable", function (node) {
321
348
  var contentEditable = !isExpandCollapsed(node);
322
349
  if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx') && _this.api && _this.api.editorDisabled) {
@@ -41,6 +41,8 @@ export declare class ExpandNodeView implements NodeView {
41
41
  private setLeftGapCursor;
42
42
  private handleArrowRightFromTitle;
43
43
  private handleArrowLeftFromTitle;
44
+ private handleUndoFromTitle;
45
+ private handleRedoFromTitle;
44
46
  private getContentEditable;
45
47
  stopEvent(event: Event): boolean;
46
48
  ignoreMutation(mutationRecord: MutationRecord | {
@@ -39,6 +39,8 @@ export declare class ExpandNodeView implements NodeView {
39
39
  private setLeftGapCursor;
40
40
  private handleArrowRightFromTitle;
41
41
  private handleArrowLeftFromTitle;
42
+ private handleUndoFromTitle;
43
+ private handleRedoFromTitle;
42
44
  private getContentEditable;
43
45
  stopEvent(event: Event): boolean;
44
46
  ignoreMutation(mutationRecord: MutationRecord | {
@@ -41,6 +41,8 @@ export declare class ExpandNodeView implements NodeView {
41
41
  private setLeftGapCursor;
42
42
  private handleArrowRightFromTitle;
43
43
  private handleArrowLeftFromTitle;
44
+ private handleUndoFromTitle;
45
+ private handleRedoFromTitle;
44
46
  private getContentEditable;
45
47
  stopEvent(event: Event): boolean;
46
48
  ignoreMutation(mutationRecord: MutationRecord | {
@@ -39,6 +39,8 @@ export declare class ExpandNodeView implements NodeView {
39
39
  private setLeftGapCursor;
40
40
  private handleArrowRightFromTitle;
41
41
  private handleArrowLeftFromTitle;
42
+ private handleUndoFromTitle;
43
+ private handleRedoFromTitle;
42
44
  private getContentEditable;
43
45
  stopEvent(event: Event): boolean;
44
46
  ignoreMutation(mutationRecord: MutationRecord | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^35.12.2",
37
37
  "@atlaskit/button": "^17.14.0",
38
- "@atlaskit/editor-common": "^79.1.0",
38
+ "@atlaskit/editor-common": "^79.2.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.1.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
41
41
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",