htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
check changes beforeunload + split& mergecells


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.

 


lvni900
User

Jan 24, 2003, 4:47 PM

Post #1 of 21 (6271 views)
Shortcut
check changes beforeunload + split& mergecells Can't Post

Html forms are great, but ... when you leave the browser, or navigate to another page, every input you've made may be lost if you did not submit the data.

The same goes for HtmlArea.

But since HtmlArea is an htmleditor, and html-editors allways ask if you want to save your changes before leaving, I made a new config variable en some changes to the editor.js to prevent the user to exit or to go to another page without saving the content.

How: add the following config statement: checkChanges (case sensitive!)

config.checkChanges = 1; (if you don't want the check, put config.checkChanges = 0;)

Take the modifications marked "// insert by lvn : check editor changes" over in your editor.js
(in attachment my htmlarea zip containing the editor.js)

What is the effect:
On every editor invoked using the config.checkChanges = 1, every modified editor that was not saved will exit with the following message:

Are you shure you want to navigate away from this page?
Your document has been changed, discard changes?
Press OK to continue, or Cancel to stay on the current page.
followed by ok and cancel buttons.
Note the 1st and 3th line cannot be changed, they're build in in MSHTML.

If you have submit buttons, you'll need to add some code before submitting, else the same question will be asked. Add the following code:

var newContent = document.all["_" +objname + "_editor"].contentWindow.document.body.innerHTML;
setGlobalVar("_" + objname + "_initialText",newContent);


(where objname = the name of the editor field)

You can try this out on http://zemstlaar.port5.com/ww/editor.php (please do no upload large images since the space I get at this free provider is rather limited).

For the ones asking merge and split cell's on tables, I implemented these function in the same release.

Have fun with it,

Leo.
Attachments: htmlarea.zip (78.2 KB)


ho2
New User

Jan 29, 2003, 5:12 PM

Post #2 of 21 (6224 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Hi lvni900

I think there is a bug in relation to the code below. The format menu shows up empty in the case where the lang is not en or nl.

// formatblock

if (fblangObj.lang == config.systemLang[0]) {fbvalue = fblangObj.name;}
if (fblangObj.lang == config.browserLang[0]) {fbname = fblangObj.name;}




lvni900
User

Jan 29, 2003, 10:24 PM

Post #3 of 21 (6218 views)
Shortcut
Re: [ho2] check changes beforeunload + split& mergecells [In reply to] Can't Post

I know, you should translate it, what language are you using?

This is due to the dynamic MSHTML-code: instead of using a universal code, it uses translated labels!
They had the same thing in msaccess or msword programming before:if becomes indien etc.. if you wanted to port some programming from 1 language to the other ...

If you have ie6 it can be done dynamically, but the whole thing better stays compatible with 5.5, you can find the translations on (ie6 needed):

http://msdn.microsoft.com/workshop/samples/author/editing/DialogHelper/blockformatsshowme.htm

Can you reply with the appropriate labels found on that page - the response depends on the language in which your browser is installed.(Case sensitive!)


basmul
Novice

Jan 30, 2003, 10:13 AM

Post #4 of 21 (6204 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Leo,

Thanx for this mighty fine additions. However the merge function keeps giving me the error that I'm not in the left cell. Tried it in all the cells in the table.

Somehow the left check in the code is not realy doing what it's supposed to.
I'll take a look at it but somehow I think you'll be quicker Wink.

Groetjes,

Bas


lvni900
User

Jan 30, 2003, 1:26 PM

Post #5 of 21 (6193 views)
Shortcut
Re: [basmul] check changes beforeunload + split& mergecells [In reply to] Can't Post

I wan't be quicker, I really do not have the time right now.

Anyway, the mergefunction is more complex than I thought. I made it because different people asked for it.

The left cell warning was intentious, jus to keep the thing simple, but indeed in some cases you keep getting the message.

So, take your time to look at the problem, and if you have the time, just re-write it.

Leo.


ho2
New User

Jan 30, 2003, 2:54 PM

Post #6 of 21 (6184 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Hi lvni900

My lang is da but I want to use english menus, so I just removed the nl stuff from my copy and that works fine. My point was that if you want your script to work for any lang (without modifications of cause), the formatblock implementation should be fixed. Also the other menus are not using lang but are allways english, so why for the formatblock ?

Mayby I'm wrong,I'm not a js specialist.

:) ho2


jay
New User

Jan 30, 2003, 3:56 PM

Post #7 of 21 (6181 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Thanks for all of your modifications. They are fantastic! I am using your modifcation that prompts users to save their changes if they leave which works great but...I have submit buttons and I tried to include the code that you suggested but it's still prompting me. I put it in the editor.js file. Can you tell me what I'm doing wrong? Many thanks, Leo

var newContent = document.all["_" +objname + "_editor"].contentWindow.document.body.innerHTML;
setGlobalVar("_" + objname + "_initialText",newContent);


J


basmul
Novice

Jan 30, 2003, 5:09 PM

Post #8 of 21 (6172 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Leo as stated by me before I'm just a beginner at this but thinking it through for half an hour I thought of something so simple it has to be wrongFrown

But maybe you can tell me if this would work or not since you coocked up the original code.

I decided to drop the whole left check bit in front and just use the currentrow and currentcell passed through paramvars.
Then I thought wat about just adding up the collspan of the two considered cells? So I did.

function mergeCells(tbody,currTr,currTd){
//first check if there are cells to the right
if (currTd.cellIndex < currTr.cells.length-1) {
//get current colspan and cell to be merged's colspan
//add the two together to get the new one,
//move the conetent and delete the right one
var currColSpan = currTd.colSpan ;
var mergeCellColSpan = currTr.cells(currTd.cellIndex+1).colSpan;
var mergeCell = currTr.cells(currTd.cellIndex+1);
currTd.innerHTML = currTd.innerHTML + mergeCell.innerHTML;
currTr.deleteCell(currTd.cellIndex + 1);
currTd.colSpan = currColSpan+mergeCellColSpan ;
}
else {
alert('Select the leftmost cell of the split to merge.');
}
}

Let me know if this will work

Greets,
Bas



P.S. just found out that the insert row before and after bits have to check the colspans too because everything gets messed up if you don't. I'm starting to think of a popupwindow for operations on the current selected row and or cell, this would solve the many many buttons needed on the toolbar and introduces table colouring,cell formating posibilities. Any thoughts on this one ?

(This post was edited by basmul on Jan 30, 2003, 5:20 PM)


lvni900
User

Jan 31, 2003, 4:29 PM

Post #9 of 21 (6145 views)
Shortcut
Re: [ho2] check changes beforeunload + split& mergecells [In reply to] Can't Post

It's the f... ms-html that uses language dependent labels: if you want the drop down to point at the right formatblock, you need to do a query of the selection, and alas, the language dependend label is returned! (The language in which the browser is installed). There's a solution with the dialog helper classes, but since they're only implemented in ie6 I choose to put them in a table.

If you have ie6, you can test this out on the following page:

http://msdn.microsoft.com/workshop/samples/author/editing/DialogHelper/blockformatsshowme.htm

Either you implement it using dlgHelper.blockFormats, but then your users must have ie6, either you copy the labels displayed at that page in the config table.

Anyone a better id?


lvni900
User

Jan 31, 2003, 4:36 PM

Post #10 of 21 (6144 views)
Shortcut
Re: [jay] check changes beforeunload + split& mergecells [In reply to] Can't Post

Where did you put your submit button?

Inside the editor (editor.js) or in your html-page?

objname is the editor.js variable that holds the name of the textarea you're using for the editor. If you use this code in the html-page, you'll have to replace the objname by the name of the field:

var newContent = document.all["_yourfieldnamehere_editor"].contentWindow.document.body.innerHTML;
setGlobalVar("_yourfieldnamehere_initialText",newContent);

You'll have to repeat it for each editor in your page.


lvni900
User

Jan 31, 2003, 4:48 PM

Post #11 of 21 (6142 views)
Shortcut
Re: [basmul] check changes beforeunload + split& mergecells [In reply to] Can't Post

It's rather late to test it out, and this weekend I will not have time, I'll do it next week.

Anyway, the idea of a property pallete for table row and detail is perfect! But a lot of work: if you look at all the properties you can get and set! And of course this could be integrated in the contextmenus.

If you need an overview of all the properties you can set or get:

Table: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/table.asp

Row: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/tr.asp

Detail: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/td.asp


lvni900
User

Feb 1, 2003, 10:40 AM

Post #12 of 21 (6119 views)
Shortcut
Re: [basmul] check changes beforeunload + split& mergecells [In reply to] Can't Post

Your mergeCells seem to work fine.

Only ... colums can be merged with splitted cells next to it, is that intentious?


basmul
Novice

Feb 1, 2003, 3:44 PM

Post #13 of 21 (6107 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Leo,

I don't realy see the difference between colums and splitted cells. When one splits a cell it in fact adds a column to the table and give the cells directly underneath or above a colspan + 1. But I've seen some rather strange results with this in cell-allignment but it still works. Maybe I've to take a look at the split function also.

Then again I'm still pondering over the idea of making a more generic popup window. However I've got the same situation you're in overhere. I've got a deadline on tuesday for a bulkmailing application with inline images, file attachments and a wysiwyg html-editor (guess wich one Smile ) I've also made a popup window in htmlarea that serves as a basis for a form editor and need to finish that too.

I'll try to do some work on htmlarea tables some time soon, but since all of this has a learning-curve for me don't expect miracles.

What would solve a great problem is a way of visualy selecting 1 or more cells in a table and then do operations on them.
Anyone out ther know of a way to select the cells visualy. (mousedown/drag/mouserelease would create a selectionrange of cells wich in turn could get a style of border: 1px dotted #ff0000 or something like that)

All ideas/input are welcome,

Bas
All things of beauty are defenseless.


AtK
User

Feb 2, 2003, 11:14 AM

Post #14 of 21 (6090 views)
Shortcut
Re: [basmul] check changes beforeunload + split& mergecells [In reply to] Can't Post


In Reply To
What would solve a great problem is a way of visualy selecting 1 or more cells in a table and then do operations on them.
Anyone out ther know of a way to select the cells visualy. (mousedown/drag/mouserelease would create a selectionrange of cells wich in turn could get a style of border: 1px dotted #ff0000 or something like that)


thats heavy stuff, cause the "contenteditable" function is from internet explorer, and microsoft has not implented a "select more cells/rows"-function, think we should wait until htmlarea 3 arrives, wich don´t need the IE-stuff i think, so we can add what we want and don´t have to look at the IE-specific functions...

AtK

mod: i also work on a complex version for table-mod´s, but give me time, within this business is time money :-)

greetz
AtK


lvni900
User

Feb 2, 2003, 2:34 PM

Post #15 of 21 (6085 views)
Shortcut
Re: [AtK] check changes beforeunload + split& mergecells [In reply to] Can't Post

On http://zemstlaar.port5.com/ww/editor.php I added property palettes for tables rows and cells.

I think that gives freedom to change anything wanted on a table, without complex programming nor making editor.js heavyer (made some external html pages).

You can try it out clicking on the right-mouse button within a cell.


basmul
Novice

Feb 3, 2003, 4:45 AM

Post #16 of 21 (6071 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

Leo,

That's the way to go! Cool and fast as always.
I'll dive into the example and do some more tests.

Bas
All things of beauty are defenseless.


AtK
User

Feb 3, 2003, 6:06 AM

Post #17 of 21 (6065 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post


In Reply To
On http://zemstlaar.port5.com/ww/editor.php I added property palettes for tables rows and cells.

I think that gives freedom to change anything wanted on a table, without complex programming nor making editor.js heavyer (made some external html pages).

You can try it out clicking on the right-mouse button within a cell.


Nice and fast as ever :-).

but there is an error, if you do some on the select-buttons in the mod-html´s, u get the error "105, objekt erwartet"

and, please put a zip with :-)

greetz
AtK


lvni900
User

Feb 3, 2003, 10:26 AM

Post #18 of 21 (6055 views)
Shortcut
Re: [AtK] check changes beforeunload + split& mergecells [In reply to] Can't Post

Zip comes when the whole thing is finished.
I'm still working on it, it was just to give you a first preview.


lvni900
User

Feb 3, 2003, 3:59 PM

Post #19 of 21 (6038 views)
Shortcut
Re: [AtK] check changes beforeunload + split& mergecells [In reply to] Can't Post

Hi atk, I saw somewher on the forum you're speaking German, is this correct? Since you're not accepting private messages, i'll put my question in the forum:

I need the exact translations for the blockformat tags (making htmlarea blockformat multilingual), but need someone having a German browser (ie6) to do this for me.

It is quite simple: go to following url

http://msdn.microsoft.com/workshop/samples/author/editing/DialogHelper/blockformatsshowme.htm

then note all the possible values of the dropdownbox (case sensitive) and reply them.

Wollen sie das fur mir machen bitte? Vielen dank.

Leo.


lvni900
User

Feb 3, 2003, 4:17 PM

Post #20 of 21 (6033 views)
Shortcut
Re: [AtK] check changes beforeunload + split& mergecells [In reply to] Can't Post

What select buttons do you mean? Ich erwarte kein objekte, nur objects ;=)

Row properties is getting in shape, let me know if you like this more.

(Click on the colorbuttons to get the colorpicker).

Table and cells still have to be done.


AtK
User

Feb 4, 2003, 2:26 AM

Post #21 of 21 (6014 views)
Shortcut
Re: [lvni900] check changes beforeunload + split& mergecells [In reply to] Can't Post

@ Leo: klar ;-)


Quote
Choose a Block Format
Normal
Formatiert
Adresse
Überschrift 1
Überschrift 2
Überschrift 3
Überschrift 4
Überschrift 5
Überschrift 6
Nummerierte Liste
Aufzählung
Verzeichnisliste
Menüliste
Definitionsterm
Definition


If u go to "table properties" and want to change the align, u get this error :).

Hehe, yes, i don´t want pm´s, i always get confused of them, but i published my email :-).

greetz
AtK

 
 
 


Search for (options)