Open Bug 97155 Opened 24 years ago Updated 10 months ago

Disable creating links when selection doesn't have text or an image

Categories

(SeaMonkey :: Composer, defect)

defect

Tracking

(Not tracked)

People

(Reporter: TucsonTester2, Unassigned)

References

Details

Attachments

(1 obsolete file)

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1) BuildID: 20010821 Creating a table then highlight in table with mouse and creating a link gives the text for the link as mixed. Creating a table then pressing ctrl-A, then creating a link gives no text for link name. Reproducible: Always Steps to Reproduce: 1. Open a new composer page 2. Click on table and create a teble of 2 X 2 then press ok 3. Press Ctrl -A to select all 4. Right click on mouse and salect create link Actual Results: No text is in table and the link name is blank Expected Results: To see (Mixed Fields) as the name of the link If you highlight the table even thoough there is no text then try to creat a link it will give you "Mixed Fields" as the name of the link.
-->cmanske
Assignee: brade → cmanske
Summary: Text is missing in creation of table link usinh Ctrl-A → Text is missing in creation of table link using Ctrl-A
Status: UNCONFIRMED → NEW
Ever confirmed: true
We should probably just disable creating links if selection contains no text or images, since the link isn't actually created in those cases.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
spam composer change
Component: Editor: Core → Editor: Composer
Milestone load balancing.
Target Milestone: mozilla1.0 → mozilla0.9.7
ComposerCommands.js: Check selection to enable creating a link. editorOverlay.xul: Moved "cmd_link" into commandset that gets checked when selection changes. EditorContextMenu.js: Be sure command enabling is done when context popup is created.
Changing summary for a better description.
Keywords: patch, review
Summary: Text is missing in creation of table link using Ctrl-A → Disable creating links when selection doesn't have text or an image
Whiteboard: EDITORBASE, FIX IN HAND, need r=,sr=
what is the performance hit with this change?
I put a test "dump" statement in the isCommandEnabled() to show that this does not impact on performance when user is typing or moving caret around with arrow keys. Impact on window startup: In mail compse, none until user clicks in the content area, then all commands that change with selection changed are updated. In Composer, it is updated along with all the other style commands and does not appear to impact on new window start time (subjective - no timing done.)
It seems that the only reason you need to get the selection as text is to test its length: + var selText = window.editorShell.GetContentsAs("text/plain", gOutputSelectionOnly); + return (selText && selText.length > 0); Isn't there a more efficient way to get the length of the selected text?
OS: Windows NT → All
Hardware: PC → All
What we really need is a 'CanInsertLink' API on the editor. Failing that, I think this workaround is OK. r=sfraser
Attachment #57521 - Flags: review+
After reviews and discussion, we decided that getting the selection text is probably not a good strategy to test for link enabling. Technically, a link may be created around just about any HTML content, and we will investigate why it isn't always doing that now.
Keywords: patch, review
Whiteboard: EDITORBASE, FIX IN HAND, need r=,sr= → EDITORBASE
From jfrancis on the dup bug 103957: Charlie, I'm happy to help here but the first issue seems to be what is the link dialog doing to determine if it needs to ask for link text? I'm not really familiar with the code there. Hoping you can look into that and tell me what editor call needs to behave differently for you, or perhaps what new functionality you need.
*** Bug 103957 has been marked as a duplicate of this bug. ***
Joe: The link dialog always looks for "link text" when the selection is empty; getting it by OutputToString(contentsAs, "text/plain", gOutputSelectionOnly); Hence the suggested fix above that uses that to see if there's any text in the selection. But we backed off from that since that can be an expensive call to make just for enabling a command. So we're left with the problem of creating link(s) correctly when selection spans block elements such as table cells, in which case the <a> element(s) should be inserted under all block elements in the selection? But even if we did this correctly, with <a> elements wrapping the <br> inside each cell of a table, there would not be any visible indication of the link until a user typed something inside a table cell. Thus the original complaint, which is technically invalid, imho,would still stand. The only thing I think we should fix is to be sure inserting of <a> elements throughout a selection obeys HTML parent/child rules.
Assignee: cmanske → jfrancis
Status: ASSIGNED → NEW
Attachment #57521 - Attachment is obsolete: true
Attachment #57521 - Flags: review+
Whiteboard: EDITORBASE → EDITORBASE-
Component: Editor: Composer → Editor: Core
Whiteboard: EDITORBASE-
098
Target Milestone: mozilla0.9.7 → mozilla0.9.8
pushing off 098 to 099
Target Milestone: mozilla0.9.8 → mozilla0.9.9
the swami says: things that will not land in 099!
Target Milestone: mozilla0.9.9 → mozilla1.0
Moving bugs to Mozilla1.1 that are not EDITORBASE+.
Moz 1.1
Target Milestone: mozilla1.0 → mozilla1.1
The trunk is the wave of the future!
Target Milestone: mozilla1.1alpha → mozilla1.1beta
The days of having a half dozen milestones out in front of us to divide bugs between seem to be gone, though I dont know why. Lumping everything together as far out as I can. I'll pull back things that I am working on as I go.
Target Milestone: mozilla1.1beta → mozilla1.2beta
migrating milestones now that there are more available. i'll pull these back as I work on them
Target Milestone: mozilla1.2beta → mozilla1.4beta
QA Contact: sujay → editor
Assignee: mozeditor → nobody
Severity: normal → S3
Severity: S3 → --
Component: DOM: Editor → Composer
Product: Core → SeaMonkey
Target Milestone: mozilla1.4beta → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: