@atlaskit/editor-plugin-code-block-advanced 12.0.22 → 12.0.23
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 +8 -0
- package/dist/cjs/nodeviews/codeBlockAdvanced.js +3 -25
- package/dist/es2019/nodeviews/codeBlockAdvanced.js +3 -21
- package/dist/esm/nodeviews/codeBlockAdvanced.js +3 -25
- package/dist/types/nodeviews/codeBlockAdvanced.d.ts +0 -2
- package/package.json +4 -7
- package/src/nodeviews/codeBlockAdvanced.ts +3 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 12.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`eea5a45d85ede`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eea5a45d85ede) -
|
|
8
|
+
Clean up feature gate `platform_editor_code_block_dogfooding_patch`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 12.0.22
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -58,7 +58,6 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
58
58
|
(0, _defineProperty2.default)(this, "themeCompartment", new _state.Compartment());
|
|
59
59
|
(0, _defineProperty2.default)(this, "maybeTryingToReachNodeSelection", false);
|
|
60
60
|
(0, _defineProperty2.default)(this, "mouseDownInBorderArea", false);
|
|
61
|
-
(0, _defineProperty2.default)(this, "mouseDownInsideCodeMirror", false);
|
|
62
61
|
(0, _defineProperty2.default)(this, "pmFacet", _state.Facet.define());
|
|
63
62
|
(0, _defineProperty2.default)(this, "wordWrappingEnabled", false);
|
|
64
63
|
(0, _defineProperty2.default)(this, "lineNumbersHidden", false);
|
|
@@ -75,29 +74,15 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
75
74
|
});
|
|
76
75
|
(0, _defineProperty2.default)(this, "handleBorderAreaMouseDown", function (event) {
|
|
77
76
|
var isBorderArea = _this.isBorderAreaClick(event);
|
|
78
|
-
|
|
79
|
-
_this.mouseDownInBorderArea = isBorderArea;
|
|
80
|
-
} else {
|
|
81
|
-
// Later click can follow a drag; remember where the interaction began.
|
|
82
|
-
_this.mouseDownInsideCodeMirror = !isBorderArea;
|
|
83
|
-
}
|
|
77
|
+
_this.mouseDownInBorderArea = isBorderArea;
|
|
84
78
|
if (isBorderArea && event.target === _this.cm.scrollDOM) {
|
|
85
79
|
// Stop CodeMirror from restoring stale inner selection before node selection.
|
|
86
80
|
event.preventDefault();
|
|
87
81
|
}
|
|
88
82
|
});
|
|
89
83
|
(0, _defineProperty2.default)(this, "handleBorderAreaClick", function (event) {
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
// Dragging across lines leaves a CodeMirror selection; keep it instead of selecting the node.
|
|
96
|
-
if (_this.mouseDownInsideCodeMirror && _this.hasCodeMirrorTextSelection() || !_this.isBorderAreaClick(event)) {
|
|
97
|
-
_this.mouseDownInsideCodeMirror = false;
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
_this.mouseDownInsideCodeMirror = false;
|
|
84
|
+
if (!_this.mouseDownInBorderArea) {
|
|
85
|
+
return;
|
|
101
86
|
}
|
|
102
87
|
|
|
103
88
|
// Prevent CodeMirror from restoring its inner selection after we hand focus and selection
|
|
@@ -473,13 +458,6 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
473
458
|
});
|
|
474
459
|
this.updating = false;
|
|
475
460
|
}
|
|
476
|
-
}, {
|
|
477
|
-
key: "hasCodeMirrorTextSelection",
|
|
478
|
-
value: function hasCodeMirrorTextSelection() {
|
|
479
|
-
return this.cm.state.selection.ranges.some(function (range) {
|
|
480
|
-
return !range.empty;
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
461
|
}, {
|
|
484
462
|
key: "isBorderAreaClick",
|
|
485
463
|
value: function isBorderAreaClick(event) {
|
|
@@ -40,7 +40,6 @@ class CodeBlockAdvancedNodeView {
|
|
|
40
40
|
_defineProperty(this, "themeCompartment", new Compartment());
|
|
41
41
|
_defineProperty(this, "maybeTryingToReachNodeSelection", false);
|
|
42
42
|
_defineProperty(this, "mouseDownInBorderArea", false);
|
|
43
|
-
_defineProperty(this, "mouseDownInsideCodeMirror", false);
|
|
44
43
|
_defineProperty(this, "pmFacet", Facet.define());
|
|
45
44
|
_defineProperty(this, "wordWrappingEnabled", false);
|
|
46
45
|
_defineProperty(this, "lineNumbersHidden", false);
|
|
@@ -57,29 +56,15 @@ class CodeBlockAdvancedNodeView {
|
|
|
57
56
|
});
|
|
58
57
|
_defineProperty(this, "handleBorderAreaMouseDown", event => {
|
|
59
58
|
const isBorderArea = this.isBorderAreaClick(event);
|
|
60
|
-
|
|
61
|
-
this.mouseDownInBorderArea = isBorderArea;
|
|
62
|
-
} else {
|
|
63
|
-
// Later click can follow a drag; remember where the interaction began.
|
|
64
|
-
this.mouseDownInsideCodeMirror = !isBorderArea;
|
|
65
|
-
}
|
|
59
|
+
this.mouseDownInBorderArea = isBorderArea;
|
|
66
60
|
if (isBorderArea && event.target === this.cm.scrollDOM) {
|
|
67
61
|
// Stop CodeMirror from restoring stale inner selection before node selection.
|
|
68
62
|
event.preventDefault();
|
|
69
63
|
}
|
|
70
64
|
});
|
|
71
65
|
_defineProperty(this, "handleBorderAreaClick", event => {
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
// Dragging across lines leaves a CodeMirror selection; keep it instead of selecting the node.
|
|
78
|
-
if (this.mouseDownInsideCodeMirror && this.hasCodeMirrorTextSelection() || !this.isBorderAreaClick(event)) {
|
|
79
|
-
this.mouseDownInsideCodeMirror = false;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
this.mouseDownInsideCodeMirror = false;
|
|
66
|
+
if (!this.mouseDownInBorderArea) {
|
|
67
|
+
return;
|
|
83
68
|
}
|
|
84
69
|
|
|
85
70
|
// Prevent CodeMirror from restoring its inner selection after we hand focus and selection
|
|
@@ -412,9 +397,6 @@ class CodeBlockAdvancedNodeView {
|
|
|
412
397
|
});
|
|
413
398
|
this.updating = false;
|
|
414
399
|
}
|
|
415
|
-
hasCodeMirrorTextSelection() {
|
|
416
|
-
return this.cm.state.selection.ranges.some(range => !range.empty);
|
|
417
|
-
}
|
|
418
400
|
isBorderAreaClick(event) {
|
|
419
401
|
const target = event.target;
|
|
420
402
|
if (!(target instanceof HTMLElement)) {
|
|
@@ -51,7 +51,6 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
51
51
|
_defineProperty(this, "themeCompartment", new Compartment());
|
|
52
52
|
_defineProperty(this, "maybeTryingToReachNodeSelection", false);
|
|
53
53
|
_defineProperty(this, "mouseDownInBorderArea", false);
|
|
54
|
-
_defineProperty(this, "mouseDownInsideCodeMirror", false);
|
|
55
54
|
_defineProperty(this, "pmFacet", Facet.define());
|
|
56
55
|
_defineProperty(this, "wordWrappingEnabled", false);
|
|
57
56
|
_defineProperty(this, "lineNumbersHidden", false);
|
|
@@ -68,29 +67,15 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
68
67
|
});
|
|
69
68
|
_defineProperty(this, "handleBorderAreaMouseDown", function (event) {
|
|
70
69
|
var isBorderArea = _this.isBorderAreaClick(event);
|
|
71
|
-
|
|
72
|
-
_this.mouseDownInBorderArea = isBorderArea;
|
|
73
|
-
} else {
|
|
74
|
-
// Later click can follow a drag; remember where the interaction began.
|
|
75
|
-
_this.mouseDownInsideCodeMirror = !isBorderArea;
|
|
76
|
-
}
|
|
70
|
+
_this.mouseDownInBorderArea = isBorderArea;
|
|
77
71
|
if (isBorderArea && event.target === _this.cm.scrollDOM) {
|
|
78
72
|
// Stop CodeMirror from restoring stale inner selection before node selection.
|
|
79
73
|
event.preventDefault();
|
|
80
74
|
}
|
|
81
75
|
});
|
|
82
76
|
_defineProperty(this, "handleBorderAreaClick", function (event) {
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
// Dragging across lines leaves a CodeMirror selection; keep it instead of selecting the node.
|
|
89
|
-
if (_this.mouseDownInsideCodeMirror && _this.hasCodeMirrorTextSelection() || !_this.isBorderAreaClick(event)) {
|
|
90
|
-
_this.mouseDownInsideCodeMirror = false;
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
_this.mouseDownInsideCodeMirror = false;
|
|
77
|
+
if (!_this.mouseDownInBorderArea) {
|
|
78
|
+
return;
|
|
94
79
|
}
|
|
95
80
|
|
|
96
81
|
// Prevent CodeMirror from restoring its inner selection after we hand focus and selection
|
|
@@ -466,13 +451,6 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
466
451
|
});
|
|
467
452
|
this.updating = false;
|
|
468
453
|
}
|
|
469
|
-
}, {
|
|
470
|
-
key: "hasCodeMirrorTextSelection",
|
|
471
|
-
value: function hasCodeMirrorTextSelection() {
|
|
472
|
-
return this.cm.state.selection.ranges.some(function (range) {
|
|
473
|
-
return !range.empty;
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
454
|
}, {
|
|
477
455
|
key: "isBorderAreaClick",
|
|
478
456
|
value: function isBorderAreaClick(event) {
|
|
@@ -28,7 +28,6 @@ declare class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
28
28
|
private selectionAPI;
|
|
29
29
|
private maybeTryingToReachNodeSelection;
|
|
30
30
|
private mouseDownInBorderArea;
|
|
31
|
-
private mouseDownInsideCodeMirror;
|
|
32
31
|
private cleanupDisabledState;
|
|
33
32
|
private languageLoader;
|
|
34
33
|
private pmFacet;
|
|
@@ -68,7 +67,6 @@ declare class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
68
67
|
private clearProseMirrorDecorations;
|
|
69
68
|
private handleBorderAreaMouseDown;
|
|
70
69
|
private handleBorderAreaClick;
|
|
71
|
-
private hasCodeMirrorTextSelection;
|
|
72
70
|
private isBorderAreaClick;
|
|
73
71
|
stopEvent(e: Event): boolean;
|
|
74
72
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.23",
|
|
4
4
|
"description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
33
33
|
"@atlaskit/prosemirror-history": "^1.0.0",
|
|
34
|
-
"@atlaskit/tmp-editor-statsig": "^124.
|
|
35
|
-
"@atlaskit/tokens": "^15.
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^124.1.0",
|
|
35
|
+
"@atlaskit/tokens": "^15.6.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"@codemirror/autocomplete": "6.18.4",
|
|
38
38
|
"@codemirror/commands": "6.7.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"codemirror-lang-elixir": "4.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^116.
|
|
52
|
+
"@atlaskit/editor-common": "^116.26.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
55
55
|
},
|
|
@@ -98,9 +98,6 @@
|
|
|
98
98
|
},
|
|
99
99
|
"platform_editor_code_block_folding_analytics": {
|
|
100
100
|
"type": "boolean"
|
|
101
|
-
},
|
|
102
|
-
"platform_editor_code_block_dogfooding_patch": {
|
|
103
|
-
"type": "boolean"
|
|
104
101
|
}
|
|
105
102
|
},
|
|
106
103
|
"devDependencies": {
|
|
@@ -82,7 +82,6 @@ class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
82
82
|
private selectionAPI: EditorSelectionAPI | undefined;
|
|
83
83
|
private maybeTryingToReachNodeSelection = false;
|
|
84
84
|
private mouseDownInBorderArea = false;
|
|
85
|
-
private mouseDownInsideCodeMirror = false;
|
|
86
85
|
private cleanupDisabledState: (() => void) | undefined;
|
|
87
86
|
private languageLoader: LanguageLoader;
|
|
88
87
|
private pmFacet = Facet.define<DecorationSource>();
|
|
@@ -513,12 +512,7 @@ class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
513
512
|
private handleBorderAreaMouseDown = (event: MouseEvent) => {
|
|
514
513
|
const isBorderArea = this.isBorderAreaClick(event);
|
|
515
514
|
|
|
516
|
-
|
|
517
|
-
this.mouseDownInBorderArea = isBorderArea;
|
|
518
|
-
} else {
|
|
519
|
-
// Later click can follow a drag; remember where the interaction began.
|
|
520
|
-
this.mouseDownInsideCodeMirror = !isBorderArea;
|
|
521
|
-
}
|
|
515
|
+
this.mouseDownInBorderArea = isBorderArea;
|
|
522
516
|
|
|
523
517
|
if (isBorderArea && event.target === this.cm.scrollDOM) {
|
|
524
518
|
// Stop CodeMirror from restoring stale inner selection before node selection.
|
|
@@ -527,20 +521,8 @@ class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
527
521
|
};
|
|
528
522
|
|
|
529
523
|
private handleBorderAreaClick = (event: MouseEvent) => {
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
} else {
|
|
535
|
-
// Dragging across lines leaves a CodeMirror selection; keep it instead of selecting the node.
|
|
536
|
-
if (
|
|
537
|
-
(this.mouseDownInsideCodeMirror && this.hasCodeMirrorTextSelection()) ||
|
|
538
|
-
!this.isBorderAreaClick(event)
|
|
539
|
-
) {
|
|
540
|
-
this.mouseDownInsideCodeMirror = false;
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
this.mouseDownInsideCodeMirror = false;
|
|
524
|
+
if (!this.mouseDownInBorderArea) {
|
|
525
|
+
return;
|
|
544
526
|
}
|
|
545
527
|
|
|
546
528
|
// Prevent CodeMirror from restoring its inner selection after we hand focus and selection
|
|
@@ -552,10 +534,6 @@ class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
552
534
|
this.selectCodeBlockNode(undefined);
|
|
553
535
|
};
|
|
554
536
|
|
|
555
|
-
private hasCodeMirrorTextSelection(): boolean {
|
|
556
|
-
return this.cm.state.selection.ranges.some((range) => !range.empty);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
537
|
private isBorderAreaClick(event: MouseEvent): boolean {
|
|
560
538
|
const target = event.target;
|
|
561
539
|
if (!(target instanceof HTMLElement)) {
|