htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
'context' update: Small update for CVS, code ready


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


Sponge
Novice

Nov 25, 2003, 2:45 AM

Post #1 of 1 (2989 views)
Shortcut
'context' update: Small update for CVS, code ready Can't Post

Hi,

Could someone please commit this very small piece of code to the CVS, in the function

"HTMLArea.prototype.updateToolbar = function(noStatus) {"

then:

Code
    var attrs = []; 
if (/(.*)\[(.*?)\]/.test(context)) {
context = RegExp.$1;
attrs = RegExp.$2.split(","); }

context = context.toLowerCase(); //split context on ","
var contextarray = context.split(",");
for (var y = 0; y < contextarray.length;y++)
{

context = contextarray[y] var match = (context == "*");
for (var k in ancestors) {
if (!ancestors[k]) {
// the impossible really happens.
continue;
}
if (match || (ancestors[k].tagName.toLowerCase() == context)) {
inContext = true;
for (var ka in attrs) {
if (!eval("ancestors[k]." + attrs[ka])) {
inContext = false;
break;
}
}
if (inContext) {
break;
}
}
}
}
}

This code will allow multiple context sensitivities. right now, you can only use one, like "a", which will trigger on an URL. But, with the code above you can simply use the context: "a,img", and it will trigger on both a link and an image!

So could someone please put this in the CVS? Smile

 
 
 


Search for (options)