Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#71 2019-12-10 18:17:10

etc
Developer
Registered: 2010-11-11
Posts: 3,780
Website

Re: Dev news

phiw13 wrote #320415:

Currently, I have a form to insert images in an article

<txp:images id='<txp:yield name="id" />' break=''>...

Does those improvements offer me anything in such a case? I have other short forms which follow similar pattern although a bit more complicated.

You can replace id='<txp:yield name="id" />' with yield="id". Not big save in this case, but when using multiple attributes, yield="author, category, etc" becomes much shorter and more readable than

author='<txp:yield name="author" />' category='<txp:yield name="category" />' etc='<txp:yield name="etc" />'

Not related, but you also don’t really need if_yield check in your code.

Offline

#72 2019-12-10 18:26:06

etc
Developer
Registered: 2010-11-11
Posts: 3,780
Website

Re: Dev news

phiw13 wrote #320416:

One button/ link (next to the Title field?) to trigger the dialog, and inside the dialog a mini-tab style thing (“HTML” | ”Text” – with “Text” meaning actual parsed Textile, current “Preview”). And add the Live preview under it.

Yep, along these lines. Templates welcome.

Is there sometimes a (visible) gap or delay between what I type and what is rendered in the preview thingie? As far as I understand there is a round trip to the server to parse Textile, which may account for some (although I test on localhost, sometimes it s not necessarily faster than a closely live server, esp with a good fiber connection).

Yes, the preview is generated 1s after you stop typing (the delay will be customizable). You’d certainly hate stressing your server on each keystroke, even on a fiber connection. And what waist of energy it would be!

(that is not a huge problem for me as I do most if not all of my writing in a real text editor – BBEdit still doesn’t s**k and can handle preview of Textile)

Unfortunately, BBEdit is not up to date with php-textile, so you get a biased output.

Offline

#73 2019-12-10 22:53:10

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,051
Website

Re: Dev news

etc wrote #320420:

You can replace id='<txp:yield name="id" />' with yield="id". Not big save in this case, but when using multiple attributes, yield="author, category, etc" becomes much shorter and more readable than

author='<txp:yield name="author" />' category='<txp:yield name="category" />' etc='<txp:yield name="etc" />'…

Thanks, the whole possibility is much clearer now.

Not related, but you also don’t really need if_yield check in your code.

Noted. When I originally wrote that snippet, I think it was kinda needed, but to be honest I don’t remember why that was.

~

Unfortunately, BBEdit is not up to date with php-textile, so you get a biased output.

Yes, known issue. I should try to remember to report it again. Still more than good enough for my needs and the editor is immensely more powerful than anything you may want to try in a textarea / contenteditable in a browser.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#74 2019-12-11 06:04:01

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,051
Website

Re: Dev news

etc wrote #320421:

Yep, along these lines. Templates welcome.

OK – here is a first pass mock up.

The “Preview’ link (lime outline, because I can :-)) uses the “code” icon, same as the tagbuilder. I didn’t see anything in the collection that would really fit and the “eye“ icon is already in use on the View link under the Publish/Save button. I reused the code of the previous mini tabs; not sure if the div is technically needed and the ARIA code is probably in need of some improvement (there is some specific ARIA roles and so on for tab bar, need to look it up).

(Sandspace theme, because, and the link on the “HTML” tab is non-functional)


Where is that emoji for a solar powered submarine when you need it ?

Offline

#75 2019-12-11 06:19:36

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,174
Website

Re: Dev news

phiw13 wrote #320429:

OK – here is a first pass mock up.

like!


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#76 2019-12-11 11:57:55

etc
Developer
Registered: 2010-11-11
Posts: 3,780
Website

Re: Dev news

phiw13 wrote #320429:

OK – here is a first pass mock up.

I like it, but would move Preview link to New/Duplicate/View area.

Is this layout ok for everybody? I would then start by transferring HTML/Preview controls to the preview dialog.

Offline

#77 2019-12-11 12:19:35

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,343
Website

Re: Dev news

etc wrote #320440:

I like it, but would move Preview link to New/Duplicate/View area.

Is this layout ok for everybody? I would then start by transferring HTML/Preview controls to the preview dialog.

Yes and no, I would keep the preview link in the write column but near the heading instead of by the main text area.

  1. It’s a preview of what you are writing, not of what the final published page will look like (if moved to the publish button area its going to get confused with the view link that is already there).
  2. It’s a preview of all contents of the write column, not just the main text area.

Offline

#78 2019-12-11 12:27:11

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,051
Website

Re: Dev news

Agree with philwareham – putting that Preview link in the New/Duplicate/View area will ber very confusing.

@philwareham You would put the Preview link before the meta data block, yes?


Where is that emoji for a solar powered submarine when you need it ?

Offline

#79 2019-12-11 12:40:18

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,343
Website

Re: Dev news

phiw13 wrote #320442:

@philwareham You would put the Preview link before the meta data block, yes?

Basically where the (now removed) #view-modes div was, yes. Since it governs the whole of that region (title, main, excerpt, potentially custom fields one day, etc.).

Offline

#80 2019-12-11 12:46:14

etc
Developer
Registered: 2010-11-11
Posts: 3,780
Website

Re: Dev news

philwareham wrote #320441:

Yes and no

As you say :-) Currently the ‘previewable’ set is fixed (Title/Body/Excerpt), but this will surely change in cf branch. Which makes me think we should have a Preview link for every Textilable input rather than a common one, but it is future.

Offline

Board footer

Powered by FluxBB