TINY-11875: Fix content css truncated when bundling, add validation to build step (#10193)

This commit is contained in:
Shan
2025-02-25 17:58:13 +08:00
committed by GitHub
parent f6b40d123d
commit 839fffa13d
3 changed files with 18 additions and 6 deletions

View File

@ -0,0 +1,6 @@
project: tinymce
kind: Fixed
body: Skin UI content CSS was truncated when bundling, causing CSS styles to be missing.
time: 2025-02-25T10:06:08.0508+08:00
custom:
Issue: TINY-11875

View File

@ -2,7 +2,7 @@
// Comments
//
@document-comment-color: if(@content-ui-darkmode = true, mix(@color-active, @color-black, 20%), lighten(@color-active, 20%));
@document-comment-color: if(@content-ui-darkmode = true, mix(@color-active, @color-black, 20%), lighten(@color-active, 20%));
@document-comment-active-color: @color-active;
@document-comment-background-color: @document-comment-color;
@document-comment-active-background-color: if(@content-ui-darkmode = true, mix(@color-active, @color-black, 20%), @document-comment-active-color);
@ -41,12 +41,10 @@
border-radius: 3px;
box-shadow: 0 0 0 2px @keyboard-focus-outline-color;
&:has(
img[data-mce-selected],
&:has(img[data-mce-selected],
> audio[data-mce-selected],
> video[data-mce-selected],
span.mce-preview-object[data-mce-selected]
) {
span.mce-preview-object[data-mce-selected]) {
box-shadow: none;
}
}

View File

@ -20,7 +20,15 @@ module.exports = function (grunt) {
grunt.log.error(err);
return done(false);
}
const content = `tinymce.Resource.add('${file.replace(/\.min.css$/, '.css')}', \`${data.split("\n")[0]}\`)`
const fileLines = data.split("\n");
// Check if the minified CSS file has more than 2 lines
// Line 1: The minified CSS content
// Line 2: The sourcemap comment, eg: (/*# sourceMappingURL=content.min.css.map */)
if (fileLines.length > 2) {
grunt.fail.fatal(`Failed to create JS resource for ${srcPath}. Expected minified CSS contains ${fileLines.length} lines instead of the expected 2 or fewer.`);
}
const content = `tinymce.Resource.add('${file.replace(/\.min.css$/, '.css')}', \`${fileLines[0]}\`)`
grunt.file.write(destPath, content);
processed++;