button in the editor when crayon is not an option

3.39K viewsIssues
0

Hi.

I am batteling an issue here.

I am setting up AnsPress on a development site, before moving it to my live site to replace Sabai Discuss plugin.

My site has issues with the Crayon plugin, so I can’t use this on my site but have found the Mivhak syntax highlighter plugin

This plugin is faster and works perfect, when the content is created in the admin. The extension to TinyMCE is only loaded in the admin.

But it has a very nice feature, which highlights all content encapsulated in <code> or <pre> tags, so if I only was able to have a simple button on the TinyMCE editor which would wrap selection in <code> I would be happy.

Unfortnuatly this is only available in the Text (html) editor in wordpress, and I need it in the visual editor.

I have written a few TinyMCE plugins to insert this <code> tag, but when these plugins are loaded, then hitting the “Post Question / Answer” button, does not save the contents of the editor.

I am stuck right now. I have been working on this for days now.

I really need a simple button which will wrap the selected text in <code></code> tags or <pre></pre> tags, in the TinyMCE editor in the AnsPress plugin.

Can you please help me with this?

My site is in Danish, so I have downloaded the language file from the wordpress site and I have completed the translation from 17% translated to 100% translated.

The WordPress online translation tools sucks, so can I send you this language file by mail?

I really only need this <code> feature in order for exchanging the sabai discuss and set AnsPress live on my site, so I hope to hear from you. You should really give Mivhak a try instead of crayon. It is so much better.

0

Please try answer suggested here: http://wordpress.stackexchange.com/questions/144705/unable-to-add-code-button-to-tinymce-toolbar

It does work for me, always.

If above solution does not work then there there must be an error. Please check console for error or share your site link so that we can see.

Also, all translation must be done on WordPress translation site. Their tool feels complicated in first view but its very simple. Let me know if I can do anything to help you with understanding translation tool.

commented on answer

I do not have issues creating the buttons, it is the fact that when I load a TinyMCE plugin, then the editor does not save.

It does not matter that it is a simple plugin which basically only writes hello world in the editor, the second I add a plugin the Anspress answer is not saved.

And there is no message in the console, no error message on the server nothing.

I have discovered that firefox is more troublesome with anspress than safari.

I have tried to deactivate all other plugins, and I have switched theme to 2015 theme. No improvement.

Also the post is actully saved in the database, I can find the answer in the admin, but the page does not reload.

And even if I reload the page then not all answers are shown.

Now I know that the editor in anspress and wordpress 4.5 have issues. I have reported a problem with the URL icon.

So perhaps it is a conflict with wordpress 4.5 and the upgrades made to the tinyMCE editor.

I think so. Recent TinyMCE update broke some functionality. I am checking if there is anything we can update.

I know, but 4.5.1 does not fix the issues I have with tinyMCE in AnsPress. I have upgraded everything.