@atlaskit/editor-plugin-placeholder 6.5.0 → 6.5.2
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,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-placeholder
|
|
2
2
|
|
|
3
|
+
## 6.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 6.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
14
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
15
|
+
project refs are setup
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 6.5.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -68,6 +68,8 @@ var cycleThroughPlaceholderPrompts = function cycleThroughPlaceholderPrompts(pla
|
|
|
68
68
|
var displayedText = '';
|
|
69
69
|
var animationTimeouts = [];
|
|
70
70
|
var clearAllTimeouts = function clearAllTimeouts() {
|
|
71
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
72
|
+
|
|
71
73
|
animationTimeouts.forEach(function (timeoutId) {
|
|
72
74
|
return clearTimeout(timeoutId);
|
|
73
75
|
});
|
|
@@ -140,10 +142,14 @@ function createPlaceholderDecoration(editorState, placeholderText, placeholderPr
|
|
|
140
142
|
if (docNode) {
|
|
141
143
|
// Extract only the inline content from paragraphs, avoiding block-level elements
|
|
142
144
|
// that can interfere with cursor rendering
|
|
145
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
146
|
+
|
|
143
147
|
docNode.children.forEach(function (node) {
|
|
144
148
|
// For paragraph nodes, serialize their content (inline elements) directly
|
|
145
149
|
// without the wrapping <p> tag
|
|
146
150
|
if (node.type.name === 'paragraph') {
|
|
151
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
152
|
+
|
|
147
153
|
node.content.forEach(function (inlineNode) {
|
|
148
154
|
var inlineDOM = serializer.serializeNode(inlineNode);
|
|
149
155
|
placeholderNodeWithText.append(inlineDOM);
|
|
@@ -155,6 +161,8 @@ function createPlaceholderDecoration(editorState, placeholderText, placeholderPr
|
|
|
155
161
|
}
|
|
156
162
|
});
|
|
157
163
|
var markElements = placeholderNodeWithText.querySelectorAll('[data-prosemirror-content-type="mark"]');
|
|
164
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
165
|
+
|
|
158
166
|
markElements.forEach(function (markEl) {
|
|
159
167
|
if (markEl instanceof HTMLElement) {
|
|
160
168
|
markEl.style.setProperty('color', "var(--ds-text-subtlest, #6B6E76)");
|
|
@@ -162,6 +170,8 @@ function createPlaceholderDecoration(editorState, placeholderText, placeholderPr
|
|
|
162
170
|
});
|
|
163
171
|
// Ensure all child elements don't block pointer events or cursor
|
|
164
172
|
var allElements = placeholderNodeWithText.querySelectorAll('*');
|
|
173
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
174
|
+
|
|
165
175
|
allElements.forEach(function (el) {
|
|
166
176
|
if (el instanceof HTMLElement) {
|
|
167
177
|
el.style.pointerEvents = 'none';
|
|
@@ -420,6 +430,8 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
420
430
|
var isDestroyed = false;
|
|
421
431
|
var activeTypewriterTimeouts = [];
|
|
422
432
|
var clearAllTypewriterTimeouts = function clearAllTypewriterTimeouts() {
|
|
433
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
434
|
+
|
|
423
435
|
activeTypewriterTimeouts.forEach(function (clearFn) {
|
|
424
436
|
return clearFn();
|
|
425
437
|
});
|
|
@@ -428,6 +440,8 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
428
440
|
return new _safePlugin.SafePlugin({
|
|
429
441
|
key: pluginKey,
|
|
430
442
|
state: {
|
|
443
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
444
|
+
|
|
431
445
|
init: function init(_, state) {
|
|
432
446
|
var _api$focus, _api$typeAhead;
|
|
433
447
|
return createPlaceHolderStateFrom({
|
|
@@ -445,6 +459,8 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
445
459
|
intl: intl
|
|
446
460
|
});
|
|
447
461
|
},
|
|
462
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
463
|
+
|
|
448
464
|
apply: function apply(tr, placeholderState, _oldEditorState, newEditorState) {
|
|
449
465
|
var _api$focus2, _placeholderState$isP, _api$typeAhead2, _ref7, _meta$placeholderText, _ref8, _meta$placeholderProm, _meta$showOnEmptyPara;
|
|
450
466
|
var meta = tr.getMeta(pluginKey);
|
|
@@ -491,6 +507,7 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
491
507
|
}
|
|
492
508
|
},
|
|
493
509
|
props: {
|
|
510
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
494
511
|
decorations: function decorations(editorState) {
|
|
495
512
|
var _api$composition, _api$showDiff;
|
|
496
513
|
var _getPlaceholderState = getPlaceholderState(editorState),
|
|
@@ -516,6 +533,7 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
516
533
|
return;
|
|
517
534
|
}
|
|
518
535
|
},
|
|
536
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
519
537
|
view: function view() {
|
|
520
538
|
var timeoutId;
|
|
521
539
|
function startEmptyParagraphTimeout(editorView) {
|
|
@@ -536,6 +554,7 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
536
554
|
}
|
|
537
555
|
}
|
|
538
556
|
return {
|
|
557
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
539
558
|
update: function update(editorView, prevState) {
|
|
540
559
|
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2') || (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga')) {
|
|
541
560
|
var prevPluginState = getPlaceholderState(prevState);
|
|
@@ -559,6 +578,7 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
|
|
|
559
578
|
}
|
|
560
579
|
}
|
|
561
580
|
},
|
|
581
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
562
582
|
destroy: function destroy() {
|
|
563
583
|
clearAllTypewriterTimeouts();
|
|
564
584
|
destroyEmptyParagraphTimeout();
|
|
@@ -52,6 +52,8 @@ const cycleThroughPlaceholderPrompts = (placeholderPrompts, activeTypewriterTime
|
|
|
52
52
|
let displayedText = '';
|
|
53
53
|
let animationTimeouts = [];
|
|
54
54
|
const clearAllTimeouts = () => {
|
|
55
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
56
|
+
|
|
55
57
|
animationTimeouts.forEach(timeoutId => clearTimeout(timeoutId));
|
|
56
58
|
animationTimeouts = [];
|
|
57
59
|
};
|
|
@@ -119,10 +121,14 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
119
121
|
if (docNode) {
|
|
120
122
|
// Extract only the inline content from paragraphs, avoiding block-level elements
|
|
121
123
|
// that can interfere with cursor rendering
|
|
124
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
125
|
+
|
|
122
126
|
docNode.children.forEach(node => {
|
|
123
127
|
// For paragraph nodes, serialize their content (inline elements) directly
|
|
124
128
|
// without the wrapping <p> tag
|
|
125
129
|
if (node.type.name === 'paragraph') {
|
|
130
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
131
|
+
|
|
126
132
|
node.content.forEach(inlineNode => {
|
|
127
133
|
const inlineDOM = serializer.serializeNode(inlineNode);
|
|
128
134
|
placeholderNodeWithText.append(inlineDOM);
|
|
@@ -134,6 +140,8 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
134
140
|
}
|
|
135
141
|
});
|
|
136
142
|
const markElements = placeholderNodeWithText.querySelectorAll('[data-prosemirror-content-type="mark"]');
|
|
143
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
144
|
+
|
|
137
145
|
markElements.forEach(markEl => {
|
|
138
146
|
if (markEl instanceof HTMLElement) {
|
|
139
147
|
markEl.style.setProperty('color', "var(--ds-text-subtlest, #6B6E76)");
|
|
@@ -141,6 +149,8 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
141
149
|
});
|
|
142
150
|
// Ensure all child elements don't block pointer events or cursor
|
|
143
151
|
const allElements = placeholderNodeWithText.querySelectorAll('*');
|
|
152
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
153
|
+
|
|
144
154
|
allElements.forEach(el => {
|
|
145
155
|
if (el instanceof HTMLElement) {
|
|
146
156
|
el.style.pointerEvents = 'none';
|
|
@@ -404,12 +414,16 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
404
414
|
let isDestroyed = false;
|
|
405
415
|
let activeTypewriterTimeouts = [];
|
|
406
416
|
const clearAllTypewriterTimeouts = () => {
|
|
417
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
418
|
+
|
|
407
419
|
activeTypewriterTimeouts.forEach(clearFn => clearFn());
|
|
408
420
|
activeTypewriterTimeouts = [];
|
|
409
421
|
};
|
|
410
422
|
return new SafePlugin({
|
|
411
423
|
key: pluginKey,
|
|
412
424
|
state: {
|
|
425
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
426
|
+
|
|
413
427
|
init: (_, state) => {
|
|
414
428
|
var _api$focus, _api$focus$sharedStat, _api$typeAhead;
|
|
415
429
|
return createPlaceHolderStateFrom({
|
|
@@ -427,6 +441,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
427
441
|
intl
|
|
428
442
|
});
|
|
429
443
|
},
|
|
444
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
445
|
+
|
|
430
446
|
apply: (tr, placeholderState, _oldEditorState, newEditorState) => {
|
|
431
447
|
var _api$focus2, _api$focus2$sharedSta, _placeholderState$isP, _api$typeAhead2, _ref, _meta$placeholderText, _ref2, _meta$placeholderProm, _meta$showOnEmptyPara;
|
|
432
448
|
const meta = tr.getMeta(pluginKey);
|
|
@@ -474,6 +490,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
474
490
|
}
|
|
475
491
|
},
|
|
476
492
|
props: {
|
|
493
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
494
|
+
|
|
477
495
|
decorations(editorState) {
|
|
478
496
|
var _api$composition, _api$showDiff, _api$showDiff$sharedS;
|
|
479
497
|
const {
|
|
@@ -500,6 +518,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
500
518
|
return;
|
|
501
519
|
}
|
|
502
520
|
},
|
|
521
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
522
|
+
|
|
503
523
|
view() {
|
|
504
524
|
let timeoutId;
|
|
505
525
|
function startEmptyParagraphTimeout(editorView) {
|
|
@@ -520,6 +540,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
520
540
|
}
|
|
521
541
|
}
|
|
522
542
|
return {
|
|
543
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
544
|
+
|
|
523
545
|
update(editorView, prevState) {
|
|
524
546
|
if (fg('platform_editor_ai_aifc_patch_beta_2') || fg('platform_editor_ai_aifc_patch_ga')) {
|
|
525
547
|
const prevPluginState = getPlaceholderState(prevState);
|
|
@@ -543,6 +565,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
543
565
|
}
|
|
544
566
|
}
|
|
545
567
|
},
|
|
568
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
569
|
+
|
|
546
570
|
destroy() {
|
|
547
571
|
clearAllTypewriterTimeouts();
|
|
548
572
|
destroyEmptyParagraphTimeout();
|
|
@@ -58,6 +58,8 @@ var cycleThroughPlaceholderPrompts = function cycleThroughPlaceholderPrompts(pla
|
|
|
58
58
|
var displayedText = '';
|
|
59
59
|
var animationTimeouts = [];
|
|
60
60
|
var clearAllTimeouts = function clearAllTimeouts() {
|
|
61
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
62
|
+
|
|
61
63
|
animationTimeouts.forEach(function (timeoutId) {
|
|
62
64
|
return clearTimeout(timeoutId);
|
|
63
65
|
});
|
|
@@ -130,10 +132,14 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
130
132
|
if (docNode) {
|
|
131
133
|
// Extract only the inline content from paragraphs, avoiding block-level elements
|
|
132
134
|
// that can interfere with cursor rendering
|
|
135
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
136
|
+
|
|
133
137
|
docNode.children.forEach(function (node) {
|
|
134
138
|
// For paragraph nodes, serialize their content (inline elements) directly
|
|
135
139
|
// without the wrapping <p> tag
|
|
136
140
|
if (node.type.name === 'paragraph') {
|
|
141
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
142
|
+
|
|
137
143
|
node.content.forEach(function (inlineNode) {
|
|
138
144
|
var inlineDOM = serializer.serializeNode(inlineNode);
|
|
139
145
|
placeholderNodeWithText.append(inlineDOM);
|
|
@@ -145,6 +151,8 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
145
151
|
}
|
|
146
152
|
});
|
|
147
153
|
var markElements = placeholderNodeWithText.querySelectorAll('[data-prosemirror-content-type="mark"]');
|
|
154
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
155
|
+
|
|
148
156
|
markElements.forEach(function (markEl) {
|
|
149
157
|
if (markEl instanceof HTMLElement) {
|
|
150
158
|
markEl.style.setProperty('color', "var(--ds-text-subtlest, #6B6E76)");
|
|
@@ -152,6 +160,8 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
152
160
|
});
|
|
153
161
|
// Ensure all child elements don't block pointer events or cursor
|
|
154
162
|
var allElements = placeholderNodeWithText.querySelectorAll('*');
|
|
163
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
164
|
+
|
|
155
165
|
allElements.forEach(function (el) {
|
|
156
166
|
if (el instanceof HTMLElement) {
|
|
157
167
|
el.style.pointerEvents = 'none';
|
|
@@ -410,6 +420,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
410
420
|
var isDestroyed = false;
|
|
411
421
|
var activeTypewriterTimeouts = [];
|
|
412
422
|
var clearAllTypewriterTimeouts = function clearAllTypewriterTimeouts() {
|
|
423
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
424
|
+
|
|
413
425
|
activeTypewriterTimeouts.forEach(function (clearFn) {
|
|
414
426
|
return clearFn();
|
|
415
427
|
});
|
|
@@ -418,6 +430,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
418
430
|
return new SafePlugin({
|
|
419
431
|
key: pluginKey,
|
|
420
432
|
state: {
|
|
433
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
434
|
+
|
|
421
435
|
init: function init(_, state) {
|
|
422
436
|
var _api$focus, _api$typeAhead;
|
|
423
437
|
return createPlaceHolderStateFrom({
|
|
@@ -435,6 +449,8 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
435
449
|
intl: intl
|
|
436
450
|
});
|
|
437
451
|
},
|
|
452
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
453
|
+
|
|
438
454
|
apply: function apply(tr, placeholderState, _oldEditorState, newEditorState) {
|
|
439
455
|
var _api$focus2, _placeholderState$isP, _api$typeAhead2, _ref7, _meta$placeholderText, _ref8, _meta$placeholderProm, _meta$showOnEmptyPara;
|
|
440
456
|
var meta = tr.getMeta(pluginKey);
|
|
@@ -481,6 +497,7 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
481
497
|
}
|
|
482
498
|
},
|
|
483
499
|
props: {
|
|
500
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
484
501
|
decorations: function decorations(editorState) {
|
|
485
502
|
var _api$composition, _api$showDiff;
|
|
486
503
|
var _getPlaceholderState = getPlaceholderState(editorState),
|
|
@@ -506,6 +523,7 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
506
523
|
return;
|
|
507
524
|
}
|
|
508
525
|
},
|
|
526
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
509
527
|
view: function view() {
|
|
510
528
|
var timeoutId;
|
|
511
529
|
function startEmptyParagraphTimeout(editorView) {
|
|
@@ -526,6 +544,7 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
526
544
|
}
|
|
527
545
|
}
|
|
528
546
|
return {
|
|
547
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
529
548
|
update: function update(editorView, prevState) {
|
|
530
549
|
if (fg('platform_editor_ai_aifc_patch_beta_2') || fg('platform_editor_ai_aifc_patch_ga')) {
|
|
531
550
|
var prevPluginState = getPlaceholderState(prevState);
|
|
@@ -549,6 +568,7 @@ export function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderTex
|
|
|
549
568
|
}
|
|
550
569
|
}
|
|
551
570
|
},
|
|
571
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
552
572
|
destroy: function destroy() {
|
|
553
573
|
clearAllTypewriterTimeouts();
|
|
554
574
|
destroyEmptyParagraphTimeout();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-placeholder",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.2",
|
|
4
4
|
"description": "Placeholder plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@atlaskit/editor-plugin-type-ahead": "^6.5.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
37
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
38
|
-
"@atlaskit/tokens": "^8.
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^14.0.0",
|
|
38
|
+
"@atlaskit/tokens": "^8.4.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@atlaskit/editor-common": "^110.
|
|
42
|
+
"@atlaskit/editor-common": "^110.36.0",
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"react-dom": "^18.2.0",
|
|
45
45
|
"react-intl-next": "npm:react-intl@^5.18.1"
|