我也有类似的问题
让doNotRemoveFormat=false;
tinymce.init({
style_formats: [
{title: \'Footer - 11px\', inline: \'span\', classes: \'admin-footer\'},
{title: \'Standard - 14px\', inline: \'span\'},
{title: \'Heading 1 - 19px\', inline: \'span\', classes: \'admin-heading-1\'},
{title: \'Heading 2 - 22px\', inline: \'span\', classes: \'admin-heading-2\'}
],
setup: function (ed) {
ed.on(\'ExecCommand\', function checkListNodes (evt) {
if (cmd === \'mceToggleFormat\') {
if(!doNotRemoveFormat) {
let val = \'runThis|\' + evt.value;
this.execCommand(\'RemoveFormat\', false, val);
} else {
doNotRemoveFormat = false;
}
} else if (cmd === \'RemoveFormat\') {
let value = evt.value.split("|");
if(value[0] === \'runThis\') {
doNotRemoveFormat = true;
this.execCommand(\'mceToggleFormat\', false, value[1])
}
});