Skip to content

Commit

Permalink
fix: #1041 content style bug when loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Jun 23, 2022
1 parent ce7ffcf commit f3db18f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5102,11 +5102,11 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
.replace(this.editorTagsBlacklistRegExp, '');
},

_cleanStyle: function (m, v, tagName) {
_cleanStyle: function (m, v, name) {
const sv = m.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);
if (sv) {
if (!v) v = [];
const style = sv[0].replace(/"/g, '').match(this._cleanStyleRegExp[tagName]);
const style = sv[0].replace(/"/g, '').match(this._cleanStyleRegExp[name]);
if (style) {
const allowedStyle = [];
for (let i = 0, len = style.length, r; i < len; i++) {
Expand Down Expand Up @@ -5845,7 +5845,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
}

this._initWysiwygArea(reload, _initHTML);
this.setDir(options.rtl ? 'rtl' : 'ltr');
},

/**
Expand Down
5 changes: 3 additions & 2 deletions test/dev/suneditor_build_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ s1.onKeyDown = function (e, core) {
}

let ss = window.ss = suneditor.create(document.getElementById('editor1'), {
rtl: true,
value: `<p style="text-align: right">Hello</p>`,
// value: `<p style="text-align: center; color: red;" onerror="a">center</p>`,
// mode: "inline",
// value: `Let $\Omega$ be the underlying randomness space. In this case, the variables $X^-$ and $X^+$ collapse to $U$. To see why, pick an arbitrary $\omega \in \Omega$:
// \begin{align*}X^-(\Omega) = \sup\left\{y\in [0,1]: F(y)<U(\omega)\right\} = \sup\left\{y\in [0,1]: P(U\leq y)<U(\omega)\right\} = \sup\left\{y\in [0,1]: y<U(\omega)\right\} = U(\omega).\end{align*}`,
Expand All @@ -422,7 +425,6 @@ let ss = window.ss = suneditor.create(document.getElementById('editor1'), {
// </p>
// `,
// __defaultFontSize: "31pt",
hideToolbar: true,
paragraphStyles: [
"spaced",
"neon",
Expand All @@ -439,7 +441,6 @@ let ss = window.ss = suneditor.create(document.getElementById('editor1'), {
fontSizeUnit: 'pt',
// lineAttrReset: '*',
alignItems: ['left', 'right', 'center'],
value: `<p style="text-align: center; color: red;" onerror="a">center</p>`,
linkTargetNewWindow: true,
imageAlignShow: false,
plugins: {...{custom_container}, ...plugins},
Expand Down

0 comments on commit f3db18f

Please sign in to comment.