@ckeditor/ckeditor5-dev-manual-server 56.5.0 → 57.0.0-alpha.0
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/dist/debug-plugin/plugin.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -1
- package/package.json +1 -1
- package/theme/shell.ts +20 -0
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { manualTestsPlugin } from "./manual-test-plugin/plugin.js";
|
|
6
6
|
export type { ManualData, ManualTestsPluginOptions } from "./manual-test-plugin/plugin.js";
|
|
7
|
+
export { ckDebugPlugin } from "./debug-plugin/plugin.js";
|
|
7
8
|
export { refreshPlugin } from "./refresh-plugin/plugin.js";
|
|
8
9
|
export { rawHtmlPlugin } from "./raw-plugin/plugin.js";
|
|
9
10
|
export { stringifyValues } from "./utils.js";
|
package/dist/index.js
CHANGED
|
@@ -514,6 +514,41 @@ function getRequiredElementByTagName(root, tagName) {
|
|
|
514
514
|
return query(root, (candidate) => isElementNode(candidate) && candidate.tagName == tagName);
|
|
515
515
|
}
|
|
516
516
|
//#endregion
|
|
517
|
+
//#region src/debug-plugin/plugin.ts
|
|
518
|
+
/**
|
|
519
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
520
|
+
* For licensing, see LICENSE.md.
|
|
521
|
+
*/
|
|
522
|
+
const SOURCE_FILE_REGEXP = /\.[cm]?[jt]sx?$/;
|
|
523
|
+
function ckDebugPlugin() {
|
|
524
|
+
const debugFlags = getDebugFlags(process.env.CK_DEBUG);
|
|
525
|
+
const plugin = {
|
|
526
|
+
name: "ck-debug",
|
|
527
|
+
enforce: "pre"
|
|
528
|
+
};
|
|
529
|
+
if (!debugFlags.size) return plugin;
|
|
530
|
+
return {
|
|
531
|
+
...plugin,
|
|
532
|
+
transform: {
|
|
533
|
+
filter: { id: { include: SOURCE_FILE_REGEXP } },
|
|
534
|
+
handler(code) {
|
|
535
|
+
if (!code.includes("// @if ")) return null;
|
|
536
|
+
const transformedCode = code.replace(/(^[ \t]*)\/\/ @if (!?[\w]+) \/\/(.*)$/gm, (match, indentation, flagName, body) => {
|
|
537
|
+
if (!debugFlags.has(flagName)) return match;
|
|
538
|
+
return `${indentation}/* @if ${flagName} */${body}`;
|
|
539
|
+
});
|
|
540
|
+
return transformedCode === code ? null : transformedCode;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
function getDebugFlags(debugOption = "") {
|
|
546
|
+
if (debugOption === "false") return /* @__PURE__ */ new Set();
|
|
547
|
+
const flags = /* @__PURE__ */ new Set(["CK_DEBUG"]);
|
|
548
|
+
debugOption.split(",").map((flag) => flag.trim()).filter(Boolean).forEach((flag) => flags.add(`CK_DEBUG_${flag.toUpperCase()}`));
|
|
549
|
+
return flags;
|
|
550
|
+
}
|
|
551
|
+
//#endregion
|
|
517
552
|
//#region src/refresh-plugin/plugin.ts
|
|
518
553
|
/**
|
|
519
554
|
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
@@ -627,4 +662,4 @@ function getFilePathFromId(id) {
|
|
|
627
662
|
* For licensing, see LICENSE.md.
|
|
628
663
|
*/
|
|
629
664
|
//#endregion
|
|
630
|
-
export { manualTestsPlugin, rawHtmlPlugin, refreshPlugin, stringifyValues };
|
|
665
|
+
export { ckDebugPlugin, manualTestsPlugin, rawHtmlPlugin, refreshPlugin, stringifyValues };
|
package/package.json
CHANGED
package/theme/shell.ts
CHANGED
|
@@ -35,6 +35,8 @@ if ( globalTarget.editor instanceof Element ) {
|
|
|
35
35
|
globalTarget.CKEditorInspector ||= CKEditorInspector;
|
|
36
36
|
globalTarget.CKEDITOR_GLOBAL_LICENSE_KEY ||= LICENSE_KEY;
|
|
37
37
|
|
|
38
|
+
autoAttachInspector();
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
* Clones the injected Shell template, fills it with current test metadata,
|
|
40
42
|
* and prepends it to the page before the test content is wrapped.
|
|
@@ -105,6 +107,24 @@ function setupManualRefreshPrompt(): void {
|
|
|
105
107
|
} );
|
|
106
108
|
}
|
|
107
109
|
|
|
110
|
+
function autoAttachInspector(): void {
|
|
111
|
+
let editor = globalTarget.editor;
|
|
112
|
+
|
|
113
|
+
Object.defineProperty( globalTarget, 'editor', {
|
|
114
|
+
configurable: true,
|
|
115
|
+
set( value ) {
|
|
116
|
+
editor = value;
|
|
117
|
+
|
|
118
|
+
if ( editor ) {
|
|
119
|
+
CKEditorInspector.attach( editor );
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
get() {
|
|
123
|
+
return editor;
|
|
124
|
+
}
|
|
125
|
+
} );
|
|
126
|
+
}
|
|
127
|
+
|
|
108
128
|
/**
|
|
109
129
|
* Opens or closes the instructions panel and synchronizes related accessibility state.
|
|
110
130
|
*/
|