Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#901 Re: User Discussion & Help » Javascript OO question: configuration prototypes » 2005-03-12 12:08:59

Yermo wrote:

That doesn't seem clean at all .... I must be missing something.

You'd do that in the default config first, in step 3.

xinha_config.Linker.backend = 'whatever';

then in step 4 that is used a default config, when you get the editors out the other end they have deep-copies of the default config which you can tailor individually for each editor in step 4 before you "start" the editors in step 5.

Plugins shouldn't work with the config values until they are registered to a plugin at the earliest (they will see the default values then), preferably not until the editor has been generated (the plugin object will have an onGenerate() method called on it when the editor it is registered to gets generated).

#902 Re: User Discussion & Help » Javascript OO question: configuration prototypes » 2005-03-12 12:02:59

Yermo wrote:

I think I've found my mental cramp.

In the case of the Linker plugin it looks like the callback is getting invoked when the editor loads so I'm guessing the plugin doesn't actually get invoked until the HTML.startEditors() call?

Thus you can safely set parameters into your plugins before that point.

I mistakenly thought the plugins were getting "invoked" at STEP 3 ... which would make setting/overriding parameters in them after the fact problematic.

Bingo smile  LoadPlugin() only does just that, loads the main javascript file(s), the realwork of a plugin doesn't begin until it's registered to an editor with registerPlugin, which is a method of an editor object.

#903 Re: User Discussion & Help » Table insert , no breaks in firefox » 2005-03-12 11:56:08

fstuurman wrote:

I have noticed a difference between an old version of htmlarea (which I have in my cms) compared to Xinha and also
the latest htmlarea3 editor, concerning the insert of a table: in the older versions in each cell a <br /> was inserted
for mozilla like browsers, is see the code is still there:

// Mozilla likes to see something inside the cell.
        (HTMLArea.is_gecko) && td.appendChild(doc.createElement("br"));

Should I create a ticket for this?

Kind regards Fred Stuurman.

Yes.  But do you mean that the <br/> is not being inserted and should be?  I havn't used tables much in moz but they seem to work ok and I wasn't aware of them having <br/> inserted in each cell?

#904 Re: User Discussion & Help » Starting and Stopping Xinha. » 2005-03-12 11:54:01

Can you post the URL where I can see what you've done, I don't quite follow.

#905 Re: User Discussion & Help » Starting and Stopping Xinha. » 2005-03-11 01:37:46

I think you'd find it fairly difficult to do.  All I can think of is perhaps if when you turned it "off" you actually just go to text mode, set the editors htmlarea div to display:none, then move the textarea out of the area so it is visible again.

just thinking out loud, something like...

editor.setMode('text');
editor._htmlArea.style.display = 'none';
var ta = editor._textArea;
ta.parentNode.removeChild(ta);
editor._htmlArea.parentNode.appendChild(ta);

and then reverse the process to turn it "on" again.

#906 Re: User Discussion & Help » Javascript OO question: configuration prototypes » 2005-03-11 01:15:57

Yermo wrote:

HTMLArea.Config.prototype.Linker = { 'backend' : _editor_url + 'plugins/Linker/scan.php' }

The object model in Javascript isn't making much sense to me. If I understand this correctly the Linker properties are being added to every HTMLArea.Config object per the prototype call? And this can happen even after the HTMLArea.Config object exists?

Correct, think of prototype as dynamically modifying the class definition itself, example..

<script langage="Javascript">
  var x = [ ];
  var y = [ ];

  // We can of course set object properties (arrays are objects of course)
  y.sayHello = function() { alert('Bugger off'); } // Set an object method

  // And we can dynamically change the definition of the "Array" class
  Array.prototype.sayHello = function() { alert('hello'); } // Dynamically add a class method

  // When you request a property (or method), JS will look for an object one first, and then use the default one if it doesn't exist
  x.sayHello(); // This will use the prototype, because the object doesn't have one
  y.sayHello(); // This will use the object's own one

  // we can change the prototype any time
  Array.prototype.sayHello = y.sayHello; // Now change the prototyped one to be the same as y's object one
  x.sayHello(); // Now x is a bad tempered as y was (still using the prototype)

  // And we can set object specific methods/properties any time
  x.sayHello = function() { alert('hello'); }; // set an object method for x now to make him happy again
  x.sayHello(); // x is in a good mood
  y.sayHello(); // y is not
</script>

however, there is a slight gotcha with the way I have prototyped the configs in,

  // But NOTE, once you get "into" the prototype through accessing a property of an object that doesn't exist 
  // (and does in the prototype) then you are modifying the prototype.
  Array.prototype.someData = { 'a' : 'a', 'b' : 'b'}
  x.someData.a = 'b'; // because someData is coming from the prototype, we are really setting Array.prototype.someData.a 
  alert(y.someData.a); // shown here, y.someData.a == 'b', because it's the prototype

it means that if you naievly do

editor.config.Linker.backend = 'foo'

you will infact change all the Linker.backend values in all editors on the page to foo, because config.Linker is being accessed through the prototype.  Of course, that might be what was required anyway.  To get around that you need to duplicate the Linker config object into the specifc config object (ie make it an object property you are modifying) before changing them..

editor.config.Linker = HTMLArea.cloneObject(editor.config.Linker)
editor.config.Linker.backend = 'aspecialbackendjustforthisone';

as it so happens however, the way of creating the editors shown in the example (which is the preferred way really) uses HTMLArea.makeEditors to, err, make the editors, and this method happens to conveniently assign each editor a (deep) copy of the default config object using cloneObject, so that you shouldn't need to do the above smile  And by that time all the plugins are loaded and have prototyped thier default config values into the main configuration, so each editor gets a pristine default config all to themselves which they can modify without affecting other editors on the page.

I guess what I'm looking for is defining some plugin level property from the example page to demonstrate how you would like per-plugin configuration variables passed in ....  just defining a global _backend_url akin to _editor_url seems really kludgey to me.

Indeed, my preference is for plugin configuration to be put in an object within the config object, as I have done for linker.

#907 Re: User Discussion & Help » How to write a simple plugin? » 2005-03-11 00:36:24

It's not, not in the plugin anyway.  That's only used if you are going to set the backend config value to include a (base) dir parameter, so that any old joe bloggs can't just call the Linker backend with whatever directory they want.  Example usage...

<?php
  $dir = realpath($_SERVER['BASE_DIR'] . '/some_directory') . '/';
  $_SESSION[sha1('dir=' . $dir)] = TRUE;
?>
<script language="Javascript">
myEditor.config.Linker.backend = _editor_url + 'plugins/Linker/scan.php?dir=<?php echo urlencode($dir) ?>';
</script>

#908 Re: User Discussion & Help » My smiley-plugin » 2005-03-11 00:27:37

Ecco wrote:

Unfortunately this doesn't do the trick. As a matter of fact, I can remove the smiley-function, doesn't make a difference.

Perhaps it is better for me to use the plugin-approach. With a lot of trial of error :-(

That would be great, then you can contribute it to Xinha! Probably the closest plugin to base smilie off is CharacterMap, it pops up a window and allows to insert various characters, you'rs wants to popup a window and allows to insert various images.  Should be almost identical smile

#909 Re: User Discussion & Help » Resource Request: HtmlArea2, HtmlArea3 and mods/hacks » 2005-03-11 00:24:05

niko wrote:

htmlarea 3 is probably avaliable through svn (??)

htmlarea3 is in the CVS at http://sourceforge.net/cvs/?group_id=69750 is not in the SVN here as we started form my fork which was already quite divergent.

#910 Re: User Discussion & Help » toolbar question » 2005-03-11 00:15:36

fstuurman wrote:

Hi,
I am trying to move some icons of plugins speciually for my cms onto the second or third
toolbar. In htmlarea3 this could be done by:

editor.config.toolbar[3].push("separator", "sas-image", "sas-link" , "anchor-link");

but the icons end up on the first toolbar at the end.

Do I have to use a different method?
Thanks and kind regards Fred Stuurman

It's tricky at the moment, basically for sme unknown reason, back before I had even released the htmlarea-fork, let alone Xinha, I changes the toolbar to require explicit "linebreak" items to break lines in the toolbar.  I don't know why I did it, and I regret doing it because it really isn't a good idea, but I don't want to change it back just yet as the whole toolbar thing needs a rework anyway to make it easier for plugins to put stuff in sensible places.

For now, best if you define your own toolbar in the configuration object, see htmlarea.js.

#911 Re: User Discussion & Help » Charset for Xinha » 2005-03-11 00:11:42

Can you submit that as a ticket niko, thanks.

#912 Re: User Discussion & Help » Trac problems » 2005-03-10 23:57:12

Grrr, rassn frassn piece of crap.  Fixed again smile  And I was actually considering using sqlite on websites at one stage.  I just can't believe how damned unstable it's being.  It's not even like the data is corrupt because I did a full sql dump, fixed up the broken tables (just recreated them) and reloaded everything into a fresh database.

I can't find any mention inthe tickets at edgewall about sqlite db's getting corrupted, there were a couple about the BDB thing though.  Oh well, fingers crossed.

Now if I could just figure out why Firefox chews through CPU when accessing sites locally on this workstation...

#913 Re: User Discussion & Help » ImageManager? » 2005-03-10 04:18:30

Yermo wrote:

Would this kind of separation be of interest to anyone else?

Absolutely a good idea, as a config variable naturally

Config.<plugin>.whatever

Feel free smile

#914 Re: User Discussion & Help » My smiley-plugin » 2005-03-10 02:31:03

smilie:      [ "Smiley", "smiles.gif", false, function(e) {e.execCommand("Smilie");} ],

should be

smilie:      [ "Smiley", "smiles.gif", false, function(e) {e.execCommand("_Smilie");} ],

#915 Re: User Discussion & Help » ImageManager? » 2005-03-10 02:25:25

Along the same vein, it will probably be a good idea in addition to the current complete package to make a 'core' package of Xinha which doesn't include plugins, and seperately package each plugin, to save download time for those who don't want all the plugins.

Don't forget the trac page for plugins - http://xinha.gogo.co.nz/Plugins

#916 Re: User Discussion & Help » ImageManager? » 2005-03-10 02:22:18

Yermo wrote:

(was message about Wei's Image Manager)

Does anyone have a source for the ExtendedFileManager? I've been using Wei's ImageManager and would like to see one or the other included in the Xinha distribution.

Thoughts?

Hi Yermo, feel free to include any (preferably working wink) plugins you want in the plugins directory, just make sure there is a README or something to show what's required to run them, and then add to the example (mostly you should be able to just add a new checkbox to the example menu and it will work).

#917 Re: User Discussion & Help » How to write a simple plugin? » 2005-03-10 02:15:14

If you don't know javascript it will be difficult.  A popup is a popup window, a plugin is some javascript code to do something that Xinha doesn't do by default smile

I'd suggest using the XMLHTTPRequest object to do the communication between client and server, and writing a plugin that exposes a panel on the left/right of the editor to form the interface.  See the existing plugins to learn how to do it.

#918 Re: User Discussion & Help » Documentation? » 2005-03-10 02:02:49

clem wrote:

The nightly release does not appear in zip format.

Thats fixed now.

Buttons fixed using the magic "linebreak". I use the word magic with care!. I still don't understand how when I registerer the charmap plug it the icon found its way next to <hr> when it is not mentioned in my config.toolbar!

The plugin pushes the button into the toolbar.  That whole area needs to be looked at again as it's not the best way in terms of configurability.

One of the features of CMSimple is its ability to include scripting in its content pages.
http://www.cmsimple.dk/?Installer%27s_M … _Scripting

Yes I see, so the users would switch to html mode ("source view") and enter these tags.  Well, as I say, currently it's not possible, the editor can only deal with valid well formed HTML, that's just the way these editors (that use the browser's API for editing) work, can't be changed (short of editing the browser source code!)

What has been requested is a way to allow showing the "server code" in source view, then transforming it to something embedded in a little "shield" image's alt tag in WYSIWYG view, and of course transforming back to the server code when you click submit.

This is all well and good, but it won't happen soon (unless somebody else cares to write the plugin, it wouldn't be hard I just don't have time right now), and it will ONLY work for simple server markup, it won't be possible to do something like...

<table>
<?php foreach($blah as $foo) { ?>
<tr>
<td><?php echo $foo ?></td>
</tr>
<?php } ?>
</table>

because there is no way to transform that into valid HTML to display in WYSIWYG mode, if we tried it would turn into something like...

<table>
<img src="php.gif" alt="foreach($blah as $foo) {" />
<tr>
<td><img src="php.gif" alt="echo $foo;" /></td>
</tr>
<img src="php.gif" alt="}" />
</table>

which is obviously invalid and the browser wouldn't have a clue how to render it.

It is a bit disconcerting to see so many references to HtmlareaEditor in the source code and examples perhaps these could be changed to Htmlarea/Xinha- to show that this code is current and not just legacy code that has been left in by mistake. (Also it give distance betwwen the product and javascript commands.

Yes, bugs take priority over branding though :)  Changing the internal object names will make us incompatable to HTMLArea, which I would like to avoid until Xinha v1.0 is out really.

#919 Re: User Discussion & Help » Resource Request: HtmlArea2, HtmlArea3 and mods/hacks » 2005-03-10 01:41:50

Xinha is a more advancd version of htmlarea3, I would defintatly not recommend using htmlarea3.  The Xinha package includes all the plugins that were distributed with htmlarea.

Never used htmlarea2.

#920 User Discussion & Help » Trac problems » 2005-03-10 00:13:06

gogo
Replies: 2

Hi all,
trac and subversion havn't been playing nicely lately.  I'm unsure why exactly but I think it's initially caused by BDB (BerkelyDB) getting stuck, locking up the subversion and then trac comes along and craps itself.

I've now changed subversion from using BDB to "FSFS" (http://svnbook.red-bean.com/en/1.1/ch05 … sect-1.3.2), hopefully this will fix the problem, the change will not affect anybody's checked out copies it's purely a backend thing.

Any tickets posted in the last 24 hours may have been lost as I had to restore from a backup again.

#921 Re: User Discussion & Help » Charset for Xinha » 2005-03-07 20:44:17

niko wrote:
gogo wrote:

I can't find any way to find the character encoding of the page from javascript or we could default it to the correct setting automagically.

I found some non-standard document-properties:
...
The difference between characterSet and actualEncoding i don't know.

Sweet smile  I suspect that actualEncoding is the encoding returned by the server in the response while characterSet is what it is being displayed as (possibly modified by a meta tag, or user-selection).

so we don't need a new config-setting!

I think it would be better, as you allude to, to have

HTMLArea.Config.charSet

config variable which is defaulted to the main document's charset as reported by those document properties (so that everybody can leave it as the default unless they have some peculiar need).  Makes it easier in the long run.

#922 Re: User Discussion & Help » svn down » 2005-03-07 13:13:30

Sqlite fell over (trac uses sqlite) on one of it's tables for some reason, I've restored it.

#923 Re: User Discussion & Help » Documentation? » 2005-03-07 12:20:09

clem wrote:

Experience tells me, that writing the retched documentation is far more complicated than coding- at least with coding the interpreter throws Warnings:- while with the documentation you are in a feedback whiteout.

Not more difficult, just different.  I'm reluctant to write it myself as I'd rather have a non-programmer do it, in my experience the minute the programmer starts writing user documentation all you succed in doing is confusing the end user smile

If the current documentation is at examples/full_example-body.html could you post this as an anouncement on this forum!

That example (in the nightly, not in the release yet) is indeed the best place for you to learn how to implement Xinha.

How to make my buttons appear on 4 lines not one superline (like it used to with htmlarea?)

Judicious use of the 'linebreak' toolbar element, see htmlarea.js for example.

How to make Undo and Redo work- it never did with htmlarea.

These buttons have been added back into the default toolbar in the nightly, they may or may not work for you, please let us know (via a ticket) if they don't.

How to suppress chars such as '<' being converted into htmlentities- that blows the search and php eval function.

Don't understand what you mean here, if you are meaning that you are trying to enter things like <?php blah ?> actually in the wysiwyg editor (or in the source code), then you're out of luck, it's not possible.  There is some desire for being able to insert (limited) php code   in source mode with it being represented with dreamweaver style shields in design mode, but thats a ways off yet.

How to supress extra linebreaks being inserted in my code- that blows preg_replace

Please explain more fully.

Then the usual stuff on adding buttons.

There are comments in htmlarea.js which explain this for now.

   /* Example on how to add a custom button when you construct the HTMLArea: */
   
      var editor = new HTMLArea("your_text_area_id");
      var cfg = editor.config; // this is the default configuration
      cfg.btnList["my-hilite"] =
       [ function(editor) { editor.surroundHTML('<span style="background:yellow">', '</span>'); }, // action
         "Highlight selection", // tooltip
         "my_hilite.gif", // image
         false // disabled in text mode
       ];
      cfg.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar

The usual stuff on using the sidepane buttonbars.

For now, the best bet is to see the Stylist plugin, but very basically you use the addPanel() method of the editor which returns a div element which you can put stuff in.

 
myPanelsDiv = editor.addPanel('right'); 
myPanelsDiv.innerHTML = 'This will appear in a panel on the right.';

and if you no longer want the panel

editor.removePanel(myPanelsDiv);

what you do inside the panel is entirely up to you.

#924 Re: User Discussion & Help » Charset for Xinha » 2005-03-07 05:49:00

Here's a link on character encoding which may be useful in this discussion
http://www.crazysquirrel.com/compgen/form-encoding.php

#925 Re: User Discussion & Help » Charset for Xinha » 2005-03-07 05:42:05

anzenews wrote:

Why not just use utf8 everywhere? We could convert all the lang stuff to utf8 and set iframe's meta tag to utf8 - both are easy tasks.

Problem is, that while learned developers such as we already use utf8, most of the world is really still using ISO-8859-1, and most of the asian world I believe is using the various other encodings (EUC-JP, BIG-5, Shift_JIS).

Board footer

Powered by FluxBB