GetPublii / Publii

The most intuitive Static Site CMS designed for SEO-optimized and privacy-focused websites.
https://getpublii.com
GNU General Public License v3.0
6.06k stars 407 forks source link

[Bug]: Custom JS Code for TinyMCE is not run when adding a new post #1237

Closed mrmashal closed 10 months ago

mrmashal commented 10 months ago

Operating system

Windows 10

Publii version

0.41.1

Post editor

WYSIWYG editor

Bug description

My tinymce.script.js file in my theme (as described in the docs) is not run when adding a new post. It is only run when editing existing posts.

I investigated the source code and seems like the script is only injected in the loadPostData() method (PostEditorTinyMCE.vue:229).

Steps to reproduce

Put a tinymce.script.js file with some test code in your theme and click on "Add new post". Don't forget to add the following section to the theme's config.json file:

    "extensions": {
        "postEditorCustomScript": true
    }

Relevant log output

No response

dziudek commented 10 months ago

@mrmashal - thank you for spotting this and for your pull request, which helped me to prepare a final solution which will be used in Publii v.0.43 :)