Closed Bug 42837 Opened 25 years ago Closed 25 years ago

charset detector should be disabled when user begin to edit

Categories

(Core :: Internationalization, defect, P3)

x86
All
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: shanjian, Assigned: shanjian)

References

Details

(Keywords: relnote, Whiteboard: [nsbeta2-], fix checked in.)

Attachments

(3 files)

After user change the charset detector, document will be reloaded. If we do not disable those items, user may lose their typing work.
Not only detector menu should be disable, the charset menu should aslo be disabled.
Status: UNCONFIRMED → NEW
Ever confirmed: true
*** Bug 38325 has been marked as a duplicate of this bug. ***
reproduce procedure 1. open composer by visiting an existing page 2. type some thing 3. select "view:character set:" select some other charset 4. The page will be reload, the newly added text is gone. expect result- we should disable the view:charset menu after the document is dirty so the action won't trash data user just typed in.
nsbeta2 for data trashing bug.
Keywords: nsbeta2
Putting on [nsbeta2-] radar. Not critical to beta2. Adding relnote keyword.
Keywords: relnote
Whiteboard: [nsbeta2-]
Status: NEW → ASSIGNED
Attached patch fix part1Splinter Review
Attached patch fix part 2Splinter Review
Attached patch fix part 3Splinter Review
Whiteboard: [nsbeta2-] → [nsbeta2-], fix available, waiting for review
cmanske suggest a better way to do this. He wrote: Another strategy, by the way, is to NOT disable the items, but force the user to save the file before letting them change charset. There's a nice method to make this easy: editorShell.CheckAndSaveDocument( [string with message to tell why they have to save]); If this returns false, then the user canceled, otherwise, the file should have been saved. We do that for things like "Preview in Browser". The problem with disabling everything is that user won't know that they have to save file, and then they can change charset, but only before they type something.
By adding following lines to function EditorSetDocumentCharacterSet(aCharset), it will do the work. if (editorShell.documentModified) { if (!editorShell.CheckAndSaveDocument(GetString("BeforeSetModifiedDocCharSet"))) return; }
That looks good to me. Be sure to add the new string to editor.properties, of course.
ftang wrote: currently, change the charset mean "reload with different charset", not save as different charset. The save into another charset is handle by the "File:Save As Charset..." menu item. So the user experience will be the following, case 1: The page have text case 1.1 The page label with charset information: The page will display correctly, load with the charset in the meta tag. User can type ANYTHING he want, when he save the document, the character cannot encode in the charset will be save as Numeric Character Reference. The user can also choose "Save As Charset..." to save into a different charset. case 1.2 the page do not label with charset information: The page may or may not load correctly case 1.2.1 if the page load correctly- the user can type anything from then and the experience is the same as 1.1 case 1.1.2 if the page load incorrectly- then the user will see existing text display as garbage, the user can choose the select "view:character coding" menu to change to another charset, the page will be reload with different default charset and repeat case 1.2.1 or 1.2.1. If the user decide not to change the charset before s/he type some text, the menus in "view:character coding" will be disable. The existing text will be display as garbage as the initial loading, any new text the user type can be saved as in case 1.1. case 2. The page do not have text The user can type ANYTHING, when the user save, the text which could be encoded in the default charset will be save as raw bytes, the other characters will be saved as numerical character reference. The user still can select "Save As Charset...." to save into other charset. Please understand there are TWO different meaning of "select a charset" meaning 1- Select a default charset for those document do not have charset information so we can see the existing text correctly. This is what the "View:Character Coding..." menu for. meaning 2- Select a charset that we want to save into. This is what the "File:Save As Charset..." menu for. Meaning 1 only meaningful when user load document, that is why we want to disable the menu once the content is dirty. Meaning 2 meaning for all the time. I think we should just disable the menu after the document is dirty.
According to ftang's comment, I disable the charset menu instead prompt a message asking user to save the document. Fix has been checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
This is not fixed in 2000-07-24-08 build.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Changes in file charsetOverlay.xul was not checked in. I do not why, probably because it is not updated and I overlook the feed back. Any way it should be OK now.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
Whiteboard: [nsbeta2-], fix available, waiting for review → [nsbeta2-], fix checked in.
I verified this in 2000-07-25-08 Win32, Mac, and Linux build.
Status: RESOLVED → VERIFIED
Blocks: 73676
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: