Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initTinyMCE() {
const { survey, runtime, options, question, changeQuestionAttribute } = this.props;
const node = runtime.findCurrentNode(survey);
if (!node.isPage()) return;
const page = runtime.findCurrentPage(survey);
const toolbar = `free_mode_save free_mode_cancel | bold italic underline strikethrough forecolor backcolor removeformat table ' +
'link unlink | alignleft aligncenter alignright alignjustify ${isDevelopment() ? ' | code' : ''} reference_answer image_manager`;
const cssLinks = survey.getCssRuntimeUrls().concat(survey.getCssPreviewUrls()).toArray();
tinymce.init({
selector: `#${TINYMCE_ID}`,
menubar: '',
toolbar,
plugins: `free_mode table contextmenu textcolor paste fullscreen link ${isDevelopment() ? 'code' : ''} reference_answer image_manager`,
contextmenu: 'link inserttable | cell row column deletetable',
body_class: 'm3-enquete__user-agent-group--PC',
body_id: 'content',
verify_html: false, // trueだと要素や属性が削除されることがある
content_css: cssLinks,
cache_suffix: options.getCacheSuffix(),
imageManagerUrl: options.getImageManagerUrl(),
init_instance_callback: this.handleTinyMCEInit.bind(this),
freeModeSaveCallback: () => {
changeQuestionAttribute(page.getId(), question.getId(), 'matrixHtml', this.getMatrixHtmlFromTinyMCE());
this.props.onHide();
},
this.change = true
const content = editor.getContent()
this.$emit('input', content)
})
},
setup(editor) {
editor.on('FullscreenStateChanged', e => {
this.fullscreen = e.state
})
},
toolbar: this.toolbar,
plugins: this.tools
}
// 合并setting
Object.assign(setting, this.setting)
tinymce.init(setting)
},
setContent(content) {
this.$nextTick(() => {
let vm = this;
let height = document.body.offsetHeight - 300;
tinymce.init({
selector: '#tinymceEditer',
branding: false,
elementpath: false,
height: height,
language: 'zh_CN.GB2312',
// menubar: 'edit insert view format table tools',
// menubar: 'view',
menubar: 'insert',
plugins: [
// 'advlist autolink lists link image charmap print preview hr anchor pagebreak imagetools',
'preview code',
'paste'
// 'searchreplace visualblocks visualchars code fullpage',
// 'insertdatetime media nonbreaking save table contextmenu directionality',
// 'emoticons paste textcolor colorpicker textpattern imagetools codesample'
],
theme: false,
inline: true,
toolbar: false,
skin_url: '//s1.wp.com/wp-includes/js/tinymce/skins/lightgray',
entity_encoding: 'raw',
setup: onSetup,
formats: {
strikethrough: { inline: 'del' }
}
};
if ( inline ) {
config.valid_elements = '#p,br,b,i,strong,em,del,a[href|target]';
}
tinymce.init( config );
}
theme: false,
inline: true,
toolbar: false,
skin_url: '//s1.wp.com/wp-includes/js/tinymce/skins/lightgray',
entity_encoding: 'raw',
setup: onSetup,
formats: {
strikethrough: { inline: 'del' }
}
};
if ( inline ) {
config.valid_elements = '#p,br,b,i,strong,em,del,a[href|target]';
}
tinymce.init( config );
}
this.on('mount', () => {
if (this.opts.ispreview) {
return;
}
TinyMCE.init(ObjectAssign({}, baseConfig, customConfig));
}).on('before-unmount', () => {
if (this.opts.ispreview) {
theme: false,
inline: true,
toolbar: false,
skin_url: '//s1.wp.com/wp-includes/js/tinymce/skins/lightgray',
entity_encoding: 'raw',
setup: onSetup,
formats: {
strikethrough: { inline: 'del' }
}
};
if ( inline ) {
config.valid_elements = '#p,br,b,i,strong,em,del,a[href|target]';
}
tinymce.init( config );
}