SVG - How do I fix this?

101 views
Skip to first unread message

Aidan Grey

unread,
Jul 27, 2019, 6:04:43 PM7/27/19
to tiddl...@googlegroups.com
I'm sorry to keep bugging you all, but at least I'm trying to help where I can too :)

So I created a new button for the editor toolbar, and I finally got it to work. (just an FYI - I've done other buttons, just all without svg icons)

two issues: 

- note that the button with the icon (</>) is not the same size as the others - how do I fix that? Is there are site that explains the svg adjustment process?

- originally, I was trying to use "wrap-lines", with an empty prefix and the suffix="<br>". I modelled on list-bullet, but all it did was wrap the selection instead of each line. So, instead, I just made it a replace, so it will insert a <br>  wherever the cursor is. Still not ideal but better than nothing.

All I can think to do is to put multiple "prefix-line"s, and do it 4 times, a character at a time. IS there a better way than this?



break.svg.tid
lineBreak.PNG

Riz

unread,
Jul 28, 2019, 12:06:23 AM7/28/19
to tiddl...@googlegroups.com
1. open your break.svg file
2. Change the tiddler type from "image/svg+xml" to "text/vnd.tiddlywiki"

Riz

unread,
Jul 28, 2019, 1:31:26 AM7/28/19
to TiddlyWiki
Hi again Aidan

Sorry I missed the second part of your question.
To start off, that is an excellent idea you put forward. I simply used to switch to text type when I need multiple line breaks, for sake of sheer laziness. What you propose is the solution, now I see it.

I can see where you went wrong. The wrap-lines function in TW-5 is a misnomer. It actually wraps the entire selection, and adds the prefix and suffix only once to the selection. Here is the difference between wrap-line and wrap-selection function in TW5.

Wrap-selection:: If you select a part of a line(for eg: a couple of lines in a sentence), wrap selection will add suffix and prefix to those few words only. This is used in toolbar buttons like bold, italics etc
Wrap-lines:: Even if you select a part of a line, it will wrap the entire line/lines and add suffix and prefix to the whole selection. That is to say, you cannot end selection in the middle of a line when you are using this function. This is used in quote-blocks and code-blocks.

In short, wrap-lines is not wrap-each-line, but wrap-all-lines-once.

Now since I want the functionality you proposed, I put together a plugin to do exactly what you want. It is a new text-edit-operation called suffix-lines. It is similar to prefix-lines, but adds suffix. If you have multiple lines in your selection, suffix will be added to each of those lines. Similar to prefix-lines, it also has a "count" parameter. So if you set the count as 2 or more, it will duplicate the suffix characters that many times.

For example, here is the text for editor toolbar button that will add 2 linebreaks at the end of each lines in selection.

<$action-sendmessage
    $message="tm-edit-text-operation"
    $param="suffix-lines"
    character="<br/>"
    count="2"
/>


There is one functionality I left out in comparison to prefix-lines. Prefix lines will remove the prefix character if it is already present in the selection. It is convienient to have it, but I hardly ever use it, so I have not bothered.

I am attaching the plugin along with a couple of other tiddlers which will actually add the editor toolbar button to add line-breaks. The toolbar button is not a part of plugin. The plugin only provides suffix-lines.js which you may use in any number of editor toolbar buttons.

sincerely
Riz
suffix-lines.json

Aidan Grey

unread,
Jul 28, 2019, 11:33:52 AM7/28/19
to TiddlyWiki
You are awesome Riz! Thanks!!

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/62db6451-7fbf-40be-850e-6d3466fed00e%40googlegroups.com.

TonyM

unread,
Jul 29, 2019, 4:17:45 AM7/29/19
to TiddlyWiki
An observation

It would be great if prefixing lines could add or remove one character. So you highlight all or some lines and add or remove one character at a time.

*
*
**
**
*
*

Regards
Tony

Aidan Grey

unread,
Jul 29, 2019, 8:41:58 AM7/29/19
to tiddl...@googlegroups.com
My experience is that though it says character, you can use however many characters you want. So prefixing an *, is easy - just select the area you want deeper and click the button again .

Only issue i have is that a space is added, and that should get removed.  

I also modified the linkify button to apply prefix/suffix to every line in selection. A single link is a trivial instance.



--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages