Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small bug in TinyMCE's template plugin #100

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Small bug in TinyMCE's template plugin #100

wants to merge 1 commit into from

Conversation

enigmatic-user
Copy link
Contributor

I encountered the following bug:

Using TinyMCE's template plugin, I tried to insert a snippet where the outmost tag was a DIV with a class:

<div class="ym-grid">
    <div class="ym-g50 ym-gl">
        <div class="ym-gbox">
            <p>Content of the left column</p>
        </div>
    </div>
    <div class="ym-g50 ym-gr">
        <div class="ym-gbox">
            <p>Content of the right column</p>
        </div>
    </div>
</div>

After adding it, only the outmost DIV was inserted, the other elements just disappeared.

I found out that this happened because my template_selected_content_classes list was empty. In the jscripts\tiny_mce\plugins\template\editor_plugin_src.js there needs to be a test if it is empty before replacing, otherwise every time a construct like this is inserted, the inner HTML will be replaced (with the empty string if nothing is selected in the editor).

IMPORTANT: Since the minified editor_plugin.js is used instead of the editor_plugin_src.js, both files should be renamed so that the editor_plugin_src.js is then the editor_plugin.js. I'll try to submit this fix to the TinyMCE repository as well; hopefully there'll be a fixed minified version, too.

Using TinyMCE's template plugin, I tried to insert a snippet where the outmost tag was a DIV with a class:

<div class="ym-grid">
    <div class="ym-g50 ym-gl">
        <div class="ym-gbox">
            <p>Content of the left column</p>
        </div>
    </div>
    <div class="ym-g50 ym-gr">
        <div class="ym-gbox">
            <p>Content of the right column</p>
        </div>
    </div>
</div>

After adding it, only the outmost DIV was inserted, the other elements just disappeared.

I found out that this happened because my template_selected_content_classes list was empty. In the jscripts\tiny_mce\plugins\template\editor_plugin_src.js there needs to be a test if it is empty before replacing, otherwise every time a construct like this is inserted, the inner HTML will be replaced (with the empty string if nothing is selected in the editor).

IMPORTANT: Since the minified editor_plugin.js is used instead of the editor_plugin_src.js, both files should be renamed so that the editor_plugin_src.js is then the editor_plugin.js. I'll try to submit this fix to the TinyMCE repository as well; hopefully there'll be a fixed minified version, too.

Signed-off-by: Jan-Christoph Ihrens <[email protected]>
@jpdevries
Copy link
Collaborator

Hi @enigmatic-user we are preparing an update for TinyMCE over at the new modxcms/TinyMCE location. Did you rename the files you mentioned in your commit?

@enigmatic-user
Copy link
Contributor Author

Hi @jpdevries,

sorry, can you help me a bit? I posted this three months ago, so I don't remember every single step... Is there a problem with the commit?

IIRC, there are two files, editor_plugin.js and editor_plugin_src.js. Since editor_plugin.js is minified, I modified the readable editor_plugin_src.js and then renamed it to editor_plugin.js since this is the file that is actually used. Of course you can instead use the new editor_plugin_src.js to create a minified editor_plugin.js.

Does this answer your question?

Cheers,
Jan

@jpdevries
Copy link
Collaborator

@enigmatic-user That does make sense. No problem with the commit. I will look into minifying that JavaScript file accordingly and should have a 4.3.4-beta1 to test soon. Thanks!

@enigmatic-user
Copy link
Contributor Author

@jpdevries: Great, I'm looking forward to the beta release!

I still have to switch all my forks of splittingred's repositories to the new locations. Or is Shaun still maintaining some of his packages?

@jpdevries
Copy link
Collaborator

You’ll want to switch the forks to modxcms/TinyMCE. All spittingred Extras are maintained there

JP DeVries
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, December 17, 2013 at 12:29 PM, Jan-Christoph Ihrens wrote:

@jpdevries (https://github.com/jpdevries): Great, I'm looking forward to the beta release!
I still have to switch all my forks of splittingred's repositories to the new locations. Or is Shaun still maintaining some of his packages?


Reply to this email directly or view it on GitHub (#100 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants