From 3dbdf36d952678aafd1dac1a9fccce51bdbb8fc0 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 7 Jan 2022 00:41:31 -0800 Subject: [PATCH] Fix CSS specificity issue with easymde's css (#18201) * Fix CSS specificity issue with easymde's css PR #18069 introduced a regression in certain overwritten editor styles because the dynamic loading of easymde.min.css causes its's style to apply after our supposed override styles. Solve this by bundling the styles into index.css. We should later aim to completely replace easymde.min.css completely with our own styles so there are no more conflicts. * Update web_src/js/features/comp/EasyMDE.js Co-authored-by: Lunny Xiao Co-authored-by: wxiaoguang --- web_src/js/features/comp/EasyMDE.js | 2 +- webpack.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/comp/EasyMDE.js b/web_src/js/features/comp/EasyMDE.js index d5c1a4c73..922d03d39 100644 --- a/web_src/js/features/comp/EasyMDE.js +++ b/web_src/js/features/comp/EasyMDE.js @@ -25,10 +25,10 @@ export async function importEasyMDE() { // https://github.com/codemirror/CodeMirror/issues/5484 // https://github.com/codemirror/CodeMirror/issues/4838 + // EasyMDE's CSS should be loaded via webpack config, otherwise our own styles can not overwrite the default styles. const [{default: EasyMDE}, {default: CodeMirror}] = await Promise.all([ import(/* webpackChunkName: "easymde" */'easymde'), import(/* webpackChunkName: "codemirror" */'codemirror'), - import(/* webpackChunkName: "easymde" */'easymde/dist/easymde.min.css'), ]); // CodeMirror plugins must be loaded by a "Plain browser env" diff --git a/webpack.config.js b/webpack.config.js index b3887f723..5736615e6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -46,6 +46,7 @@ export default { resolve(__dirname, 'web_src/js/jquery.js'), resolve(__dirname, 'web_src/fomantic/build/semantic.js'), resolve(__dirname, 'web_src/js/index.js'), + resolve(__dirname, 'node_modules/easymde/dist/easymde.min.css'), resolve(__dirname, 'web_src/fomantic/build/semantic.css'), resolve(__dirname, 'web_src/less/misc.css'), resolve(__dirname, 'web_src/less/index.less'),