0

I'm trying to work on a way to load CSS path with in the DNN CK Editor v4.18.0 preview mode, here are some images below. On Edit mode

Now the using the Custom Editor Options I've been able to use a common.css file which has all the css files path embedded in it as only one css can be used. On WYSIWYG mode Custom Editor Option Now When it comes to Preview Mode. Preview This happens below. Preview mode on

Now I tried certain things which I thought would work out first I create a cust_config.js inside the /Portal/1/xyz/cust_config.js which contains this code.

// CKEDITOR.editorConfig = function (config) {  
    // config.contentsCss = [
        // '/Portals/1/xyz/css/common.css'
    // ];
    // config.allowedContent = true;  // Ensures styles aren't blocked
// };

CKEDITOR.editorConfig = function (config) {
    config.extraPlugins = 'wysiwygarea';  // Ensure iframe editor is used
    config.contentsCss = [];  // Keep contentsCss empty to prevent overrides

    CKEDITOR.on('instanceReady', function (ev) {
        var editor = ev.editor;
        var iframe = editor.container.$.querySelector('iframe.cke_wysiwyg_frame');
        if (iframe) {
            var head = iframe.contentWindow.document.head;
            var link = iframe.contentWindow.document.createElement('link');
            link.rel = 'stylesheet';
            link.href = '/Portals/1/xyz/css/common.css';
            head.appendChild(link);
        }
    });
};

As this file is used in the Custom Editor Options > Main Settings > Configuration > Custom Config file it does run the alert but when trying to add common.css there it does not load at all when i use the edit module button, so I had to use the manual way to add common.css in the Custom Editor Options which would at least show the Edit options working but Preview fails in all way.

1 Answer 1

0

I am not an expert in customizing CKEditor, but I hope these articles will help:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.