You are here: Mozilla Editor > Character Properties Dialogs
Character Property Dialogs
by Charles ManskeThere are four Tabbed Dialog Panes that make up a related set. When a single image is selected or the user is inserting an image, the first pane is the Image Properties pane, followed by the Link and Paragraph panes. Otherwise, the first pane is the Character Properties. In addition to the behaviors specified here, all four of these property panes behave according the the rules common to all "multipane or tabbed dialogs."
1. Character Properties
Windows:
Invoke
Menu: Format | Character Properties
Note that the current selection must not be one of these single HTML objects: Image, Target, Horizontal Line, or HTML Tag.
In those cases, the Format menu will contain the properties command for the specific object instead of the default "Character Properties."
Initialization
- Fill in the Font Face combobox.
- The first list item is "Variable Width." This is used to represent the default or "no FACE attribute is set" state. The font used will be the viewer's default browser "variable width font"
- The second item is "Fixed Width," used to indicate text having the "TT" character style
- The next n items are the list of n OS-specific system fonts. If possible, include a separator in the list between the 2nd and 3rd items to differentiate the "real" fonts from the default values. There must be a limit on the number of font face items allowable (100 is used for Windows.) If the total number of fonts exceeds this limit, then add an item "Other..." which should bring up an OS-specific font picker that can handle all the installed fonts. The OS font list should be sorted alphabetically, but leave the "variable" and "fixed" items at the top.
- Add the last item: "Don't change," used to undo a font selected (i.e., it "unselects" the font face.)
- This control is a true combobox -- it has an editbox field where the user can type any font face name.
- Fill the Font Size combobox. The contents of this list depend on
the preference "editor.fontsize_mode":
- Mode = 1: Display just the list of HTML font sizes (-2, -1, 0, 1, 2, 3, 4)
- Mode = 2: Display just the list of font converted point sizes. Each HTML size value is converted to the local font point size, which depends on the default base size of the author's "Variable Width Font" and "Fixed Width Font" from their preferences. The conversion of the HTML size to point size should be independent of the OS [I need to find out if that is true in 4.x code.] For example, in Windows, if the default variable width font is 12pt, then the list of sizes is 8, 10, 12, 14, 18, 36. If the base size is 10, the list is 7, 8, 10, 12, 15, 20, 30. For modes 1 and 2, the control should be a "drop-down listbox," which only allows the user to select from values in the list.
- Mode = 3: The list has two parts: The upper part is identical to Mode 1. The lower part is a fixed list of actual point sizes, to be used with the "POINT-SIZE" HTML attribute: 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72. The dialog control should be a true combobox with an "editbox" field. This allows setting any arbitrary POINT-SIZE.
- Get the character attributes of the current selection. This is complicated by the fact that different attributes may be set in different parts of the selected text. Thus the dialog must be able to convey this "mixed" or "indeterminate" state for each attribute. This is accomplished by using 3-state checkboxes and using "Don't change" in a combobox or radio button group.
HTML Attribute | Dialog Control Setting |
---|---|
FONT FACE |
|
FONT COLOR |
|
FONT SIZE FONT POINT-SIZE |
Initialization of the Font Size combobox depends on the preference
"editor.fontsize_mode": The combobox should be a "dropdown list"
without an edit field for Modes 1 and 2. The combobox should allow
user editing of the point size for Mode 3.
|
B, I, U, STRIKE, SUP, SUB, BLINK, NOBR |
|
Dialog Rules
User Action | Response |
---|---|
Change the selected item in the font face combobox (except "Other" and "Don't change") |
Change the message under the font face combobox to describe the
selected font:
|
Edit the font name in the combobox or select the "Don't change" item at the bottom of the list | Remove the message (by displaying an empty string under the font face combobox.) |
Check the Superscript or Subscript checkbox | The Superscript and Subscript attributes should be mutually exclusive, thus if one of these checkboxes is checked, automatically uncheck the opposite attribute. |
Actions
User Action | Response |
---|---|
Select the "Other..." item in the Font Face combobox | Popup the OS-specific font selector to let the user select any font installed in the system. The resulting font face name should be displayed in the font face editbox if user closed the font selector with "OK". |
Click on the Color Picker button | Popup the Color Picker Widget |
Click the "Remove Style Settings" button | Clear all checkboxes in the "Style" group. |
Click the "Remove All Settings" button |
|
Click on Apply or OK |
|
2. Link Properties
Windows: | Mac: | UNIX: |
Appearance when some text is selected when invoked: Link
Source region when no text is selected (inserting a new
link): |
Invoke
- Menu: Format | Character Properties, then click on the Link
tab.
If the insert point (caret) or left edge point of the selection is inside of text that is a link, selecting "Character properties" will automatically put the focus in the Link dialog pane. - When creating a link:
- Menu: Insert Link.
- In the popup context menu: "Insert New Link" or "Create Link Using Selected"
- Click on the "Link" toolbar button
Initialization
- Get the current selection in the document
- If selection is just an image or we are inserting an new image
- The first pane is the Image Properties, as shown in the screen shot above.
- In the "Link Source" group area, display the label "Linked Image".
- Hide the editbox used to enter text when creating a new link (the "source text editbox.")
-
Set the
"Linked Image" URL string:
- Get the image URL (the SRC attribute) for the image
element.
- If an image URL exists, display it as static text under the "Linked Image" label. (This is in exactly the same location as the hidden editbox used to enter new link text.)
- If no image name exists yet (we must be inserting a new image), display the text "(No image URL supplied)" instead. Note: this is an suggested enhancement. In the current implementation, we act as if there's no image and show the Linked text label and editbox instead. This doesn't seem correct.
- If an image exists and it is already a link, get the URL for that link and show it in the editbox in the "Link to" region. This editbox is used to edit the HREF value of the link tag, so I will refer to it as the "HREF editbox."
- Get the image URL (the SRC attribute) for the image
element.
- If selection is not an image and we are not inserting an image:
- The first pane is the Character Properties.
- Setup the "Link Source" controls:
- If there is selected text:
- Display the text label "Linked text"
- Get the selected text (plain text without any character attributes) and display it as static text under the label, but truncate it to a size to fit on one line of the dialog. (This is the same text control used to show the image URL if the link is an image.)
- No selected text (Caret is visible instead, so we are
inserting a new link. See the screen shot above.)
- Display the label "Enter text to display for a new link"
- Hide the static text control that is used to show the linked text or linked image URL.
- Show the "source text editbox" where user can enter text for the link. (The location is exactly the same as the hidden static text.)
- If there is selected text:
- If selection is just an image or we are inserting an new image
- If the insert point (caret or left edge of selection) is in an existing link, show the URL for that link in the HREF editbox.
-
Setup the Targets
(named anchor) list
- If there is an existing link URL that is a local file:
- Search that file for all target tags (<A NAME="MyTarget">) and fill the listbox with the target names (if any).
- If at least one target was found, set the text label above the listbox to: "Select a named target in the specified file (optional)"
- Select "Selected File" in the radio button group to the right of the listbox
-
For any other
condition, use the current document:
- Fill the listbox with the targets from the current document
- If at least one target was found, set the text label above the listbox to: "Select a named target in the current page (optional)"
- Select "Current Page" in the radio button group to the right of the listbox
- If no targets were found for either the current document or a local file, set the label above the listbox to "(No targets in selected file)" and select the "Current Page" radio button.
- If there is an existing link URL that is a local file:
-
Set the
enable/disable state of the "Remove Link" button:
- If the document selection contains any links or the HREF editbox is not empty, enable the button.
- If the HREF editbox is empty and the document selection does not contain any links, disable the button.
- Save the current contents in the HREF editbox as the "last good HREF."
Dialog Rules
User Action | Response |
---|---|
Select the "Current page" or "Selected file" radio button |
|
Select a target from the Targets listbox |
Get the selected target name from the list
|
Change the link URL:
|
|
Click on the "Link" tab to switched to this pane from another pane | If the first pane is the Image Properties, update the "Linked image" string as described above. |
|
Validate the contents
of the HREF editbox:
|
Actions
Click Button | Response |
---|---|
Choose File | Popup the OS-specific Open File dialog and let user select a file. Use the caption "Link to File" for this dialog. If they do not cancel from that dialog, validate the entry (as described above) and display the user's filename URL in the HREF editbox if it is valid. |
Remove Link |
|
Extra HTML | Popup the Extra HTML dialog and save the resulting string as the "extra HTML" for the HREF element. |
OK or Apply |
|
Enhancements
Reconsider the inclusion or design of the "Remove Link" button. We currently use this button to remove links within the page as well as the trivial use of just clearing the HREF editbox. It is the only place where a button other than "Apply" changes properties in the page. Should we continue this behavior?
3. Paragraph Properties
Windows: | Mac: | UNIX: |
Invoke
Initialization
- Get the current paragraph and list style of the current selection and save as local variables ("current paragraph style" and "current list style"). Currently, this is whatever the settings are at the left edge of the selection (we ignore styles in other paragraphs in the selection). We should consider changing this as described in Enhancements.
- Fill the Paragraph style combobox list with available paragraph styles. We currently support Normal (BR or P), Headings 1 through 6 (H1 - H6), Address (ADDRESS), Preformated (PRE), List item (LI), Term name (DT), and Definition (DD)
- Fill the Additional style list with 3 items: Default (no
attribute), List (LL), and Blockquote (BLOCKQUOTE).
Suggested change: Replace this listbox with a checkbox that is labeled: "Indent the paragraph using Blockquote"
- Fill the List Style combobox list with "Bulleted (Unnumbered) list"
(UL), "Numbered List" (OL), and "Definition list" (DL).
The 4.x versions also include "Directory list" and "Menu list" but these were dropped in the initial 5.0 redesign.
-
Set the selected item in
the List style combobox from the current list style (UL, OL, or
DL.)
If we are not in a Bullet, Numbered, or Definition list, disable the list style combobox and show no selected item.
-
Set the selected item in
the Additional style combobox (or the state of the "Indent
paragraph using blockquote" checkbox)
- If the list style is set (it is OL, UL, or DL), select "List"
Using suggested change: Uncheck the Blockquote checkbox
- If the paragraph is in a BLOCKQUOTE, select "Blockquote"
Using suggested change: Check the Blockquote checkbox
- If the paragraph is not in a list or a blockquote, select
"Default"
Using suggested change: Uncheck the Blockquote checkbox
- If the list style is set (it is OL, UL, or DL), select "List"
-
Set the selected
item in the Paragraph style combobox according to the current
paragraph style, and enforce the following rules:
- If the current list style is Bullet or Unnumbered list, the current paragraph style must be "List item" (LI)
- If there current list style is Definition, the paragraph must
be either a "Term name" (DT) or "Definition" (DD) style
(If it is not currently "Definition", change it to "Term name".)
- A paragraph in a blockquote can have any paragraph style except
for list-specific types: List item, Term name, or Definition
(If current style is one of those list styles, change it to "Normal")
-
Initialize the Bullet
Style listbox and Start number editbox:
- If the List style is "Bullet List":
- Set the text above the bullet style combobox to "Bullet style:"
- Fill combobox with "Automatic", "Solid circle", "Open circle", and "Solid square"
- Disable the editbox to the right of the "Starting number" static text
- If the List style is "Numbered List":
- Set the text above the bullet style combobox to "Number style:"
- Fill the combobox with "Automatic", "1, 2, 3...", "I, II, III..." (upper case Roman numerals), "i, ii, iii..." (lower case Roman numerals), "A, B, C...", and "a, b, c..."
- Enable the "Starting number" editbox
- First time only: Get the current Starting Number (START)
value from the numbered list (OL) tag and save locally as the
"current starting number"
If it is not set, use set it to the default = 1.
- Fill starting number editbox with the current starting number.
- If the List style is "Bullet List":
- Set the alignment radio button according to the current alignment. Again, we currently only consider the alignment attribute at the left edge of the selection. Should we scan all paragraphs in the selection?
Dialog Rules
User Action | Response |
---|---|
Change selected item in the Paragraph style combobox |
|
Change selected item in the Additional style combobox (or change the Blockquote checkbox) |
In the current implementation with the "Additional style" combobox:
|
Change selected item in the List style combobox |
|
Actions
Click Button User Action |
Response |
---|---|
OK or Apply |
|
Enhancements
- We currently get the starting paragraph and list types only for the left edge of the selection. We should probably get the style for the full range selected, which would require us to deal with "mixed states" as we do with the Character attributes. This would necessitate having a "Don't change" item in the paragraph and list styles comboboxes.
- The current implementation, especially the use of the "Additional
style" combobox, is complicated by the somewhat confusing rules of HTM.
For example, the paragraph styles for each list type are constrained as
described above, but the Blockquote is kind of a hybrid. Internally, it
is similar to a list style in that it causes indentation and is a
"parent" container of the paragraph(s). But it doesn't have the strict
containment limitations as does the Bullet, Numbered, and Definition
lists. The current implementation allows those rules to be reinforced
at the expense of some clarity to the user. Since the main purpose for
the combobox is to support Blockquote, we might instead use a checkbox as described above. The downside of this
is that it may not be entirely clear to the user why this checkbox is
being turned off automatically (when a list style is selected), and it
might not be clear that they have to select either "List item", "Term
name", or "Definition" for the paragraph style before the List style
and Bullet style comboboxes are enabled. At least with the current
implemetation, the existence of the "List" item in the Additional style
combobox is an additional way to enable the list comboboxes. Here is a
screen shot with this new checkbox:
- This screen shot also shows an "Indent level" editbox and static text, which might also be a useful addition. It is simply the number of nested <BLOCKQUOTE> levels of the paragraph. This would allow indenting or outdenting multiple levels at a time.