[Resolved] Code-indent removed by wordpress editor
There is a topic here:
But when I paste the code in wordpress, the problem not solved.
i’ve tried to paste code into the visual and the text editor. in both cases the indent is not removed. what are you exactly doing and what’s your copy-source ?
best regards, Andi
Format -> Enlighter codeblock -> c#.
Visual studio -> mark code -> ctrl+c -> back to editor -> ctrl+v -> no indentation, מot even brokenץ
What’s happening if you copy the content into notepad ?
I’ve tried it with Eclipse and everything works fine..
If I copy the content into notepad the indentation still correct.
i’ve got no idea what’s going wrong…but it seems to be a problem with TinyMCE … EnlighterJS just add’s some html attibutes to the editor’s
pretag and doesn’t process the code within the editor…
as a workaround you can copy it to notepad -> copy it again -> paste it into wordpress…this works for me in most cases if something gone wrong
OK, thanks. My solution is to combine this plugin for the lighting and WP-SynHighlight to insert code in TinyMCE (with my change – Don’t add the tags of synhighlight). I suggest to copy the code-insert dialog to this plugin.
Ah ok, great idea! i will implement a “code insert dialog” which avoids such formatting issues!
Thanks! Note that the main features of such one, are to support
The plugin named above, uses editarea 0.8.1.1.
An additional editor which supports tab/Shift-Tab/Block-Shifts will follow soon with some other Enlighter specific options…it requires a deep integration into the TinyMCE editor and the documentation is very “holey” ..
I’ve just added a simple insert-only dialog (select language + insert code) which should avoid insert-copy formatting issues. if you like you can test it – should work in your case 🙂
I’ve added the insert-dialog to the current release v2.2 – please tell me if it’s working in your case 🙂
the tab/shift-tab/block-shift functions will be added later .. directly into the Visual-Editor 🙂
Very good. I think these functions (tab etc) should be in the insert dialog too.
The indentation not removed (Congrats!), but not appear exactly as I want, since I copied function with some indentation, that’s still with the full indentation in the site (the tab and shift tab functions will solve it, but note that some IDEs like VS actually use spaces and not tabs).
The Insert Dialog has to include option to choose “inline” or “code-block”, no?
Can you add rtl support? That’s means add to all code areas and language choosers an attribute dir=”ltr” because in rtl sites that’s still rtl and very ugly (try add dir=”rtl” to know how it appears in rtl sites)…
One more thing is the “Toggle RAW Code” button, it’s hide few code in some cases, I haven’t solution for that…
I hope to translate the plugin to Hebrew soon.
Thanks very much!
maybe i could add an optional checkbox to the insert dialog like “strip indentation offset” which means that the minimal offset which is found will be used as initial position.
using tabs seems to be a general problem with TinyMCE… i will try to use some other whitespace characters instead.
and of course, the inline option is missing – sorry for that.
rtl support should be possible – i will try to add it to the next release (i’m working on some additional themes currently)
could you provide me an example with the “toggle raw code” problem ? i think it’s a bug caused by some other CSS rules for
pretags on your page – maybe i can harden the Enlighter-CSS to avoid such problems.
thanks for your feedback!
best regards, Andi
- The topic ‘[Resolved] Code-indent removed by wordpress editor’ is closed to new replies.