Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: [ADDON] Quicktags for sNews  (Read 7097 times)

moshu

  • Newbie
  • *
  • Karma: 0
  • Posts: 27
    • http://crosscultural.transycan.net/blog/
[ADDON] Quicktags for sNews
« on: March 31, 2006, 03:31:49 am »

I have been working for quite a while with WP so I was familiar with Alex King's JS Quicktags:
http://www.alexking.org/index.php?content=software/javascript/content.php
As you can see on the demo/Example page there - they work in a similar way as the buttons here in the forum.

There is only one thing I hate more than wysiwyg editors: installing them for clients and then getting emails, phone calls all the time that copy/pasting from webpages, MS Word etc. they screwed up their site.
So, now that I am making a website with sNEws for a friend who is not a techie person, I wanted to make easy for him using some basic formatting. I ended up including the JS Quicktags in the admin > New Article area. Here is a snapshot how does it look like.
http://www.transycan.net/abc/quicktags.jpg
As you can see it's possible to even style it and you can easily add your own quicktags, too.

If there is any interest for it, I can try to remember what I did  ??? and post here the steps. Let me know...
Logged
In view of the fact that God limited the intelligence of man, it seems unfair that He did not also limit his stupidity.

bryn

  • Hero Member
  • *****
  • Karma: 2
  • Posts: 934
    • http://www.cssugly.com
[ADDON] Quicktags for sNews
« Reply #1 on: April 01, 2006, 08:28:28 am »

that would be a good feature for those that need simplified editing moshu

so if you can remember post your code anyway ok..you never know who might use it ;D
Logged
Over 1,000 posts of joy, sNews is not only brilliant, but fun too! thanks guys :D

grinpin

  • Newbie
  • *
  • Karma: 0
  • Posts: 19
[ADDON] Quicktags for sNews
« Reply #2 on: April 02, 2006, 01:32:45 pm »

that's a really good thing to try :)

please try to recall what you did step by step

actually, I was trying to make quicktags working in sNews but without a success
Logged

moshu

  • Newbie
  • *
  • Karma: 0
  • Posts: 27
    • http://crosscultural.transycan.net/blog/
[ADDON] Quicktags for sNews
« Reply #3 on: April 02, 2006, 04:09:52 pm »

Sorry, I couldn't get back earlier. Actually, if you have a new download of the js_quicktags.js script it is easier than what I did the first time (I had an older version on my computer and first went with that one).
Download the script: you will get 3 files - an example index.html, the js_quicktags.js and license.txt.
Open this index.html and your snews.php copy.
Copy this line [8] from index.html:
Code: [Select]
and paste it after line 409 in snews.php, so it will look like:
Code: [Select]
if_javascript_on('


In order to be able to style it with the stylesheet, my actual code looks like this:
Code: [Select]

     

     

:

The next line in your snews.php should be this:
Code: [Select]

You have to add an id, and in the example index.html it is suggested "canvas". So, make it:

Code: [Select]

Finally, add this after the line above:

Code: [Select]
It should work.

As for styling, you can add the #quicktags to your stylesheet; also note that the script creates ids for the buttons, so you can have something like:
#quicktags #ed_bold {
   font-weight: bold;
}

Edit. Almost forgot... To have the quicktags in the Edit mode, too, go to line 1246 in snews.php and modify it like this:
Code: [Select]

         


         
     

:

Logged
In view of the fact that God limited the intelligence of man, it seems unfair that He did not also limit his stupidity.

albert

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 405
    • http://www.oswt.co.uk/
[ADDON] Quicktags for sNews
« Reply #4 on: April 02, 2006, 04:36:15 pm »

Hi moshu

I touched on this with 1.3 here befor.

the code here is fine and takes only 10 mins, just added it too my site and removed tiny mice as this
code is much cleaner. Plus you can change the core code to make it complient to w3c standards

Go on all play with this code it's great....

Albert

Quote from: moshu
Sorry, I couldn't get back earlier. Actually, if you have a new download of the js_quicktags.js script it is easier than what I did the first time (I had an older version on my computer and first went with that one).
Download the script: you will get 3 files - an example index.html, the js_quicktags.js and license.txt.
Open this index.html and your snews.php copy.
Copy this line [8] from index.html:
Code: [Select]
and paste it after line 409 in snews.php, so it will look like:
Code: [Select]
if_javascript_on('


In order to be able to style it with the stylesheet, my actual code looks like this:
Code: [Select]

     

     

:

The next line in your snews.php should be this:
Code: [Select]

You have to add an id, and in the example index.html it is suggested "canvas". So, make it:

Code: [Select]

Finally, add this after the line above:

Code: [Select]
It should work.

As for styling, you can add the #quicktags to your stylesheet; also note that the script creates ids for the buttons, so you can have something like:
#quicktags #ed_bold {
   font-weight: bold;
}

Edit. Almost forgot... To have the quicktags in the Edit mode, too, go to line 1246 in snews.php and modify it like this:
Code: [Select]

         


         
     

:

Logged
Albert
http://snews.awddesign.co.uk/snews/ site: v1.3
http://snews.awddesign.co.uk/           site: v1.2 http://www.awddesign.co.uk/
“Putting together the largest collection of sNews 1.5 designs. Coming very soon :)

moshu

  • Newbie
  • *
  • Karma: 0
  • Posts: 27
    • http://crosscultural.transycan.net/blog/
[ADDON] Quicktags for sNews
« Reply #5 on: April 02, 2006, 05:07:02 pm »

Quote from: albert

Go on all play with this code it's great....

Albert

Thanks, Albert.

One more note: I was only at my first cup of coffee (plus we slept one hour less because of the DST switching), so I forgot to say that the js_quicktags.js file should be uploaded in the same directory on your server where snews.php is. But I hope that was understandable...
Logged
In view of the fact that God limited the intelligence of man, it seems unfair that He did not also limit his stupidity.

grinpin

  • Newbie
  • *
  • Karma: 0
  • Posts: 19
[ADDON] Quicktags for sNews
« Reply #6 on: April 02, 2006, 05:57:58 pm »

great :D

thanks a lot[ b]moshu[/b]
 it's working, and that's what it is supposed to do :)
Logged

moshu

  • Newbie
  • *
  • Karma: 0
  • Posts: 27
    • http://crosscultural.transycan.net/blog/
[ADDON] Quicktags for sNews
« Reply #7 on: April 09, 2006, 03:58:21 pm »

Quote from: Wgroup
Hi, thanks a lot for this mod, I've just made the changes to the search.php file and the edit buttons do appear on the edit page, but when i click on them, nothing appears in the news form. What may I have done wrong please?
I hope you meant the snews.php and not search.php...

Make sure the id (canvas in the example) is the same in the "textarea" code and the javascript following it!
See:

and
Logged
In view of the fact that God limited the intelligence of man, it seems unfair that He did not also limit his stupidity.

George Antoniadis

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 479
[ADDON] Quicktags for sNews
« Reply #8 on: April 09, 2006, 07:46:41 pm »

why don't you use tinymce/xihna or something? o_O
Logged
How I feel like I'm starless, I'm ready to fade now.
And how I feel like I'm starless, I'm hopeless and greyed out.

mejobloggs

  • Full Member
  • ***
  • Karma: 0
  • Posts: 125
[ADDON] Quicktags for sNews
« Reply #9 on: April 09, 2006, 11:29:11 pm »

Absolutely brilliant. Havn't tried it yet, but it looks just great.
Logged

grinpin

  • Newbie
  • *
  • Karma: 0
  • Posts: 19
[ADDON] Quicktags for sNews
« Reply #10 on: April 09, 2006, 11:38:29 pm »

Quote from: analyzerx
why don't you use tinymce/xihna or something? o_O

:) when you need something more powerfull & funny like tinyMCE, you use tinyMCE, and when you just need couple of  buttons (and everything in one file) to format easier you probably should use quicktags

and one more: the whole thing with quicktags just perfectly sticks with sNews "one file" idea

so it's a great simple addition to great simple sNews :)

once again thanks moshu :)
Logged

albert

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 405
    • http://www.oswt.co.uk/
[ADDON] Quicktags for sNews
« Reply #11 on: April 10, 2006, 12:24:27 pm »

Hi All

if you like playing with coding here is what I added to my js

Quote
edButtons.push(
   new edButton(
      'ed_include'
      ,'INCLUDE'
      ,'[include]'
      ,'[/include]'
      ,'q'
   )
);

works great plus I added a few more just for my site and bing go :)

Albert

Logged
Albert
http://snews.awddesign.co.uk/snews/ site: v1.3
http://snews.awddesign.co.uk/           site: v1.2 http://www.awddesign.co.uk/
“Putting together the largest collection of sNews 1.5 designs. Coming very soon :)

mejobloggs

  • Full Member
  • ***
  • Karma: 0
  • Posts: 125
[ADDON] Quicktags for sNews
« Reply #12 on: April 14, 2006, 01:55:10 am »

moshu, in that little screenshot of your quicktags, you have a tooltip saying 'Close all open tags'. I assume a description like this pops up for all tags? How do you do this? Mine does not, and it would be really helpful.

Cheers.
Logged

moshu

  • Newbie
  • *
  • Karma: 0
  • Posts: 27
    • http://crosscultural.transycan.net/blog/
[ADDON] Quicktags for sNews
« Reply #13 on: April 14, 2006, 04:30:55 am »

@mejobloggs,

I am afraid the snapshot was taken while I was implementing the script using an older version "borrowed" from WP (WordPress). But even there, only the "close all" button had tooltip, and none of the others.
Logged
In view of the fact that God limited the intelligence of man, it seems unfair that He did not also limit his stupidity.

mejobloggs

  • Full Member
  • ***
  • Karma: 0
  • Posts: 125
[ADDON] Quicktags for sNews
« Reply #14 on: April 14, 2006, 07:40:56 am »

Ok, well to make a tooltip on a button you do: title="button description"

So that just has to be added to the javascript somehow.
Logged
Pages: [1] 2