Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2021-01-11 14:08:07

Myusername
Member
Registered: 2019-12-12
Posts: 96

Re: wysiwyg editor

etc wrote #328132:

Me too, thanks for your efforts. But the simple tags encoding when switching from textile to html is not quite satisfactory:

  • images, paragraphs etc are rendered as plain text in wysiwyg editor, which makes it less wysiwyg.

Yes, I would say that seeing HTML in the wysiwyg editor makes it less wysiwyg. But we are not talking about wysiwyg/html, but wysiwyg/textile, so there will be peculiarities. I think the following:

When we type this:

<img src="image.jpeg"/>

I don’t expect this to render an image in the wysiwyg editor. If I want to “send” an image of the textile to wysiwyg, I type Textile:

!image.jpeg!

To see all the content rendered in HTML, including the tags you typed and are being rendered as plain text in the wysiwyg editor, the textpattern preview should be useful. Right?

edit: though not in textile editor, which is great. But all code formatting (linebreaks, tabulations) is mangled by textile, and notextile.. commands are removed.

Truth.

Last edited by Myusername (2021-01-11 14:10:59)

Offline

#22 2021-01-11 14:39:18

etc
Developer
Registered: 2010-11-11
Posts: 4,076
Website

Re: wysiwyg editor

Myusername wrote #328133:

When we type this:

<img src="image.jpeg"/>...

I don’t expect this to render an image in the wysiwyg editor.

To see all the content rendered in HTML, including the tags you typed and are being rendered as plain text in the wysiwyg editor, the textpattern preview should be useful. Right?

Yep, no problem for me here. But letting textile into html/txp blocks like txp:php, script etc is problematic. We’d need to somehow protect them, maybe by including inside some code block.. dunno.

Offline

#23 2021-01-14 16:28:57

Myusername
Member
Registered: 2019-12-12
Posts: 96

Re: wysiwyg editor

A textarea with real-time syntax.

I don’t think it’s an alternative, but it’s cool.

Last edited by Myusername (2021-01-14 16:34:59)

Offline

#24 2021-01-14 18:29:12

etc
Developer
Registered: 2010-11-11
Posts: 4,076
Website

Re: wysiwyg editor

Nice find, and easy to plug in.

Offline

#25 2021-01-15 19:59:38

Myusername
Member
Registered: 2019-12-12
Posts: 96

Re: wysiwyg editor

LRTEditor is a lightweight editor that does, I believe, the most boring job. Adds basic functionality to the editor, deals with updating the content and also with the mouse position after the update, etc. The cool thing is that it seems to be compatible with basically any syntax highlighting. As far as I know, there isn’t one for textile, right? If so, tell me I’ll do some tests. Ultimately, how viable would it be to create a syntax highlight for textile? Even if it is something very simple that, over time, can become something cool.

Some modifications to make it more friendly to the textile would be necessary, as well as a toolbar, which shouldn’t be a problem.

I did some bad tests and it can be seen here. I basically added some regexs (h1,h2 and images), also badly made, to manipulate the titles and images, to see how it would look. Very badly done, but can have potential in the right hands.

It is important to note that, it is only allowed to work in LRTEditor with text. Which means, the approach would be very similar to SimpleMDE, but simpler and without the heavy codemirror.

Well, take a look and see if it interests you.

Offline

#26 2021-01-15 21:10:07

etc
Developer
Registered: 2010-11-11
Posts: 4,076
Website

Re: wysiwyg editor

Myusername wrote #328181:

LRTEditor is a lightweight editor that does, I believe, the most boring job.

Thanks for sleuthing. Out of the box it looks too intrusive (impossible to type tags, at least at the beginning of the line), but all of them need parametrization.

Since we currently use jQuery though, this one looks easier to adapt to basic textile.

Offline

#27 2021-01-16 09:31:35

Myusername
Member
Registered: 2019-12-12
Posts: 96

Re: wysiwyg editor

etc wrote #328182:

(impossible to type tags, at least at the beginning of the line)

Sorry, that was my mistake. Updated.

Offline

#28 2021-01-16 11:43:30

etc
Developer
Registered: 2010-11-11
Posts: 4,076
Website

Re: wysiwyg editor

Thank you. I think it has potential, especially if it can also replace Prism.js we use for HTML preview highlighting. Probably too late for 4.8.5, but let’s try it in 4.9-dev?

Offline

#29 2021-01-16 12:41:19

Myusername
Member
Registered: 2019-12-12
Posts: 96

Re: wysiwyg editor

etc wrote #328185:

Thank you. I think it has potential, especially if it can also replace Prism.js we use for HTML preview highlighting. Probably too late for 4.8.5, but let’s try it in 4.9-dev?

It would be great.

If a syntax highlight is created for Textpattern, you can probably replace prismjs in the preview. Perhaps later, it may even extend to the page and form guides.

Last edited by Myusername (2021-01-16 12:41:41)

Offline

#30 2021-01-16 13:56:41

etc
Developer
Registered: 2010-11-11
Posts: 4,076
Website

Re: wysiwyg editor

Myusername wrote #328187:

If a syntax highlight is created for Textpattern …

I guess HTML highlighter is already available? Here is txp tag regex, if you want to experiment:

/(<\/?(?:\w+:?):\w+(?:\[-?\d+\])?(?:\s+[\w\-]+(?:\s*=\s*(?:"(?:[^"]|"")*"|\'(?:[^\']|\'\')*\'|[^\s\'"\/>]+))?)*\s*\/?\>)/

Offline

Board footer

Powered by FluxBB