Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2005-10-26 20:37:21

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

BTW, I have noticed that the quicktag editor only appears under the Write subtab.
In Pages and Forms subtabs I dont get the quicktag editor.

I cant figure out why, because I looked at the page source and the scripts are there.

Last edited by maniqui (2005-10-26 21:12:19)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#92 2005-10-27 00:29:57

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

It’s funny I noticed that and figured I had messed up my button configs. I did some poking and it seems that the addition of the drop down changed the DOM so that the calls that Mary was making before no longer work.

Here’s a quick fix.

Open upm_quicktags/lib/txp.js
==
Change 22 to read <code>upm_quicktags_toolbar(document.forms1.Form);</code>

Change line 28 to read <code>upm_quicktags_toolbar(document.forms1.html);</code>
==
That should make it work again. I’m trying to see if it can be modified to use getElementsByName which might be a little more future proof but it’s not liking it so far.


Shoving is the answer – pusher robot

Offline

#93 2005-10-27 04:22:20

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Many thanks, hakjoon.
I tried the change you suggested and now, it works in Page and Form subtabs.

Also, I have added an acronym button that works exactly as the link button, but it adds acronyms.
I want tho share this with you. I’m not a programmer, I did it “by instinct”, copy, pasting, deleting, repeting, searching and replacing.

This are the steps I followed: <ol> <li>in write.js, I have created an acronym button, based on the link button, but changed the id to “qt-acronym”. <div><code>edButtons[edButtons.length] = new edButton(‘qt-acronym’,‘acronym’,’‘,’‘,‘Acronym’); // special</code></div> </li> <li>then, in quicktag.js, I have duplicated the funcion <code>edInsertLink</code>, and rename it to <code>edInsertAcronym</code>. The following is the function I “created”: <div style=“height: 200px; overflow: auto; font-size: 80%; width: 75%;”><pre> function edInsertAcronym(myField, i)
{ if (!edCheckOpenTags(i)) { title = prompt(‘Enter the acronym title’, ‘’);

if (title) { i.tagStart = ‘&lt;acronym’;

if (title) { i.tagStart += ‘ title=”’ + title + ‘”’; }

i.tagStart += ‘&gt;’;

i.tagEnd = ‘&lt;/acronym&gt;’; } }

edInsertTag(myField, i);
}</pre></div> </li> <li>then, in also quicktags.js, look for this chunk (it should appear twice): <div style=“height: 150px; overflow: auto; font-size: 80%; width: 75%;”><pre> else if (theButton.getAttribute(‘id’) &#61;&#61; ‘qt-link’) { theButton.onclick = function () { edInsertLink(area,this); return false; }; } </pre></div> Add the following code, below each instance (two) of the above code. <div style=“height: 150px; overflow: auto; font-size: 80%; width: 75%;”><pre> else if (theButton.getAttribute(‘id’) &#61;&#61; ‘qt-acronym’) { theButton.onclick = function () { edInsertAcronym(area,this); return false; }; } </pre></div> </li> <li>upload the two files (write.js and quicktags.js)</li> <li>Go to Write Tab, and press CTRL + F5 to clean the cache</li> <li>Listo calixto!! You should see an “acronym” button in your quicktag editor, and if you click on it, you should be prompted to insert the acronym title</li>
</ul>

Finally, I dont know if what I did is the correct way. I just searched and replaced code.

And I have no doubt that this can also be implemented as a “QuickAcronyms” drop-down (similar to the QuickLinks) but I didnt tried it. I think it is a little more difficult.

Maybe this “acronym mod” can be added to a future version of this plug-in.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#94 2005-10-27 05:42:37

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Sorry ‘bout that folks, obviously I accidentally got the two calls for forms and pages swapped, thanks for letting me know. I notice that I used a similar method to fix the problem as the solution you sent me via email, Patrick, thanks for being quick to help me out.

v.4.0.2

maniqui, this behaviour is the expected, proper behaviour of the plugin. The idea is that by default it helps you output nicely formatted html, but you can certainly change it to be anything you desire, as we all can have our own particular styles that we are comfortable with. Thanks for sharing with others who may also want to change this behaviour, and for also checking to make sure it wasn’t some kind of bug.

If you check the plugin documentation (it’s near the bottom under “Advanced Enhancements”, so may not have noticed it) you will note that hacking quicktags.js isn’t needed if you’re merely adding new JavaScript functions. I have provided you custom.js (note that it is empty) for this purpose. The idea being that you won’t have to re-hack the plugin everytime I update it, and it also makes it easy for users to share back and forth.

:)

Offline

#95 2005-10-27 13:18:55

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

<blockquote>If you check the plugin documentation (it’s near the bottom under “Advanced Enhancements”, so may not have noticed it) you will note that hacking quicktags.js isn’t needed if you’re merely adding new JavaScript functions. I have provided you custom.js (note that it is empty) for this purpose. The idea being that you won’t have to re-hack the plugin everytime I update it, and it also makes it easy for users to share back and forth.</blockquote>

Thanks, Mary. I actually read your “warnings” before making my changes.
The problem is that I didnt understand exactly how to use custmon.js.

For example, in my mod, there are two a “else rules” (dont know how to exactly call them in “programming language”).

So, I didnt know how to include the “else rules” in custom.js.
Do I need to copy into custom.js the entire function where these “else rules” are contained?

I will try to move this into custmon.js an then edit my previous post.

Thanks.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#96 2005-10-27 15:17:23

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Try this in custom.js

<pre>
var acronymButton= document.getElementById(‘qt-acronym’);
if (acronymButton) { acronymButton.onclick = function () { edInsertAcronym(area,this); return false; }; }
</pre>

Haven’t actually tested this but it should work.


Shoving is the answer – pusher robot

Offline

#97 2005-10-27 15:58:24

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

I have tried to move all to custom.js, but I failed to make it work.
This is what I did: <ol> <li>I moved the “edInsertAcronym” function to custom.js</li> <li>I copied the “edShowButton” and “edShowImgButton” function to custom.js and removed all unnecesary parts, leaving only the “if… qt-acronym” chunk that calls “edInsertAcronym”</li> <li>uploaded my custom.js</li> <li>CTRL + F5 to clean cache</li>
</ol>

Nothing happens when I click the acronyn button.

I also tested hakjoon suggestion (thanks, hakjoon!) but when clicking “acronym” button I only get a page refresh.

Meanwhile, I will keep the acronym mods in quicktags.js.

Last edited by maniqui (2005-10-27 17:18:04)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#98 2005-10-27 17:14:14

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Maybe area is not passed through the way I expected I’ll take a closer look. I’ll try to get a method that works and try do a little write up on it. I haven’t actually played with custom.js, since most of what I’ve needed was just new buttons.


Shoving is the answer – pusher robot

Offline

#99 2005-10-27 19:45:08

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Patrick’s code does work, I just didn’t assign it to a variable to be used, which was an oversight. I’ll update the plugin again, in a minute or two, so area will be available.

Offline

#100 2005-10-30 01:14:19

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Did someone manage to insert a non-breaking space with a shiny little button ? It worked fine with any glyphs, characters or anything really but non-breaking space I can’t get it (or TXP) to handle it…

Edit: I meant another way but inserting a & #160; , which is a little scarry to nongeek people.

Last edited by Jeremie (2005-10-30 01:15:04)

Offline

#101 2005-10-30 01:17:37

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

v.0.4.3 is here if you didn’t notice.

Jeremie: just checking to make sure I understand, so you want the button to insert the text &nbsp; into the textarea?

Last edited by Mary (2005-10-30 03:41:33)

Offline

#102 2005-10-30 01:26:22

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Yep. I try to copy&paste using your tool in the plugin help, but it was always converted to a u0020 code. I try the u00A0 one by hand, but it seems to be converted by TXP as a regular space too.

I don’t blame your plugin :) , as I recall having some talks with Zem about TXP and nonbreaking spaces. I was just curious if someone manage to did it ?

Last edited by Jeremie (2005-10-30 01:30:26)

Offline

#103 2005-10-30 03:42:18

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

You only need to use unicode for the button label (a dom requirement, not my own), not what you want it to insert. For that, you just use plain text, i.e:

edButtons[edButtons.length] = new edButton('qt-nbsp','nbsp','&nbsp;','','Non-breaking space');

Offline

#104 2005-10-30 10:15:39

Niconemo
Member
From: Rhône-Alpes, France
Registered: 2005-04-18
Posts: 557

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

Thank you for this plugin Mary (all your plugins are great !).

I see that the link insertion is still in xhtml, there is no textile button for that (or if I missed it, I apologize and please ignore this message). As I’m using this plugin almost for educational purpose (“Hey : click and see how textile is simple”) I won’t use the default xhtml button.

I hope there will be a textile button in a next version. Meanwhile, I’ve add this incomplete (the link as to be pasted) but textile-friendly button :

<code>
edButtons[edButtons.length] = new edButton(‘qt-quote’,‘Link’,’\u0021’,’\u0021\u003ahttp\u003a\u002f\u002fpaste-your-link-here.com’,‘Textile link’);
</code>

Last edited by Niconemo (2005-10-30 10:27:23)


Nico

Offline

#105 2005-10-30 19:23:27

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [plugin] [ORPHAN] upm_quicktags: Implement Alex King’s Quicktags

mary wrote:
You only need to use unicode for the button label (a dom requirement, not my own), not what you want it to insert. For that, you just use plain text, i.e:
edButtons[edButtons.length] = new edButton('qt-nbsp','nbsp','&nbsp;','','Non-breaking space');

That’s my point. I don’t want to insert entity (which will scare non-geek writers), I want to insert directly the non-breaking space unicode character.

Offline

Board footer

Powered by FluxBB