Skip to content

Commit

Permalink
Fix qtranslate_wysiwyg CSS style (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
herrvigg committed Dec 4, 2022
1 parent a6348b7 commit b3b3f84
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/acf/js/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ const register_fields = () => {

acf.registerFieldType(acf.models.WysiwygField.extend({
type: 'qtranslate_wysiwyg',

initializeEditor: function () {
const self = this;
this.$('.acf-editor-wrap').each(function () {

const $wrap = $(this);
const $textarea = $wrap.find('textarea');
const args = {
Expand Down Expand Up @@ -185,6 +185,20 @@ const register_fields = () => {
});
}
}));
// The 'qtranslate_wysiwyg' field contains an editor wrapper for each language, already translated in each of those.
// No hooks should be set, but we update tinymce CSS to show it's translatable. For textarea html it's already set.
acf.addFilter('wysiwyg_tinymce_settings', function (mceInit, id, field) {
if (field.type === 'qtranslate_wysiwyg') {
const initCB = mceInit.init_instance_callback;
mceInit.init_instance_callback = function (editor) {
if (initCB !== undefined) {
initCB();
}
editor.getContentAreaContainer().classList.add('qtranxs-translatable');
};
}
return mceInit;
});
};

register_fields();

0 comments on commit b3b3f84

Please sign in to comment.