Interface nsIEditorType

Hierarchy

Properties

autoMaskingEnabled: boolean

autoMaskingEnabled is true if unmasked range and newly inputted characters are masked automatically. That's the default state. If false, until mask() is called, unmasked range and newly inputted characters are unmasked.

canRedo: boolean

Returns true when undo/redo is enabled and there is one or more transaction in the redo stack.

canUndo: boolean

Retruns true when undo/redo is enabled and there is one or more transaction in the undo stack.

composing: boolean

whether this editor has active IME transaction

contentsMIMEType: string

the MimeType of the document

document: Document

the DOM Document this editor is associated with, refcounted.

documentCharacterSet: string

Sets document's character set. This is available only when the editor instance is an HTMLEditor since it's odd to change character set of parent document of <input> and <textarea>.

documentIsEmpty: boolean

------------ Document info and file methods -------------- Returns true if the document has no meaningful content

documentModified: boolean

Returns true if the document is modifed and needs saving

flags: number

edit flags for this editor. May be set at any time.

isDocumentEditable: boolean

Returns true if we have a document that is not marked read-only

isSelectionEditable: boolean

Returns true if the current selection anchor is editable

newlineHandling: number

Get and set newline handling.

Values are the constants defined above.

passwordMask: string

passwordMask attribute is a mask character which is used to mask password.

rootElement: Element

the body element, i.e. the root of the editable document.

selection: Selection
selectionController: nsISelectionController

the selection controller for the current presentation, refcounted.

textLength: number

The length of the contents in characters.

undoRedoEnabled: boolean

Returns true when undo/redo is enabled (by default).

unmaskedEnd: number
unmaskedStart: number

These attributes are available only when the editor is a password field. unmaskedStart is first unmasked character index, or 0 if there is no unmasked characters. unmaskedEnd is next index of the last unmasked character. 0 means there is no unmasked characters.

wrapWidth: number

Get and set the body wrap width.

Special values: 0 = wrap to window width -1 = no wrap at all

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Add a DocumentStateListener to the editors list of doc state listeners.

    Parameters

    • listener: nsIDocumentStateListener

    Returns void

  • ------------ Various listeners methods -------------- nsIEditor holds strong references to the editor observers, action listeners and document state listeners.

    add an EditActionListener to the editors list of listeners.

    Parameters

    • listener: nsIEditActionListener

    Returns void

  • beginTransaction is a signal from the caller to the editor that the caller will execute multiple updates to the content tree that should be treated as a single logical operation, in the most efficient way possible.
    All transactions executed between a call to beginTransaction and endTransaction will be undoable as an atomic action.
    endTransaction must be called after beginTransaction.
    Calls to beginTransaction can be nested, as long as endTransaction is called once per beginUpdate.

    Returns void

  • Collapses selection at start of the document. If it's an HTML editor, collapses selection at start of current editing host ( element if it's in designMode) instead. If there is a non-editable node before any editable text nodes or inline elements which can have text nodes as their children, collapses selection at start of the editing host. If there is an editable text node which is not collapsed, collapses selection at start of the text node. If there is an editable inline element which cannot have text nodes as its child, collapses selection at before the element node. Otherwise, collapses selection at start of the editing host.

    Returns void

  • canCopy() returns true if selected content is allowed to be copied to the clipboard. Note that this always returns true if the editor is in a non-chrome HTML/XHTML document. FYI: Current user in script is only BlueGriffon.

    Returns boolean

  • canCut() returns true if selected content is allowed to be copied to the clipboard and to be removed. Note that this always returns true if the editor is in a non-chrome HTML/XHTML document. FYI: Current user in script is only BlueGriffon.

    Returns boolean

  • Can we paste? True if the doc is modifiable, and we have pasteable data in the clipboard.

    Parameters

    • aClipboardType: number

    Returns boolean

  • Clears the transactions both for undo and redo. This may fail if you call this while editor is handling something, i.e., don't call this from a legacy mutation event listeners, then, you won't see any exceptions.

    Returns void

  • cloneAttributes() is similar to Node::cloneNode(), it assures the attribute nodes of the destination are identical with the source node by copying all existing attributes from the source and deleting those not in the source. This is used when the destination element already exists

    Parameters

    • aDestElement: Element
    • aSourceElement: Element

    Returns void

  • copy the currently selected text, putting it into the OS clipboard What if no text is selected? What about mixed selections? What are the clipboard formats?

    Returns void

  • ------------ Clipboard methods --------------

    cut the currently selected text, putting it into the OS clipboard What if no text is selected? What about mixed selections? What are the clipboard formats?

    Returns void

  • deleteNode removes aChild from aParent.

    Parameters

    • child: Node

    Returns void

  • ------------ Selected content removal --------------

    DeleteSelection removes all nodes in the current selection.

    Parameters

    • action: number
    • stripWrappers: number

      If eStrip, strip any empty inline elements left behind after the deletion; if eNoStrip, don't. If in doubt, pass eStrip -- eNoStrip is only for if you're about to insert text or similar right after.

    Returns void

  • ------------ Transaction methods --------------

    turn the undo system on or off

    Returns

    if aEnable is PR_TRUE, returns NS_OK if the undo system could be initialized properly if aEnable is PR_FALSE, returns NS_OK.

    Parameters

    • enable: boolean

    Returns void

  • Sets the selection to the end of the last leaf child/descendant or the root element.

    Returns void

  • endTransaction is a signal to the editor that the caller is finished updating the content model.
    beginUpdate must be called before endTransaction is called.
    Calls to beginTransaction can be nested, as long as endTransaction is called once per beginTransaction.

    Returns void

  • forceCompositionEnd() force the composition end

    Returns void

  • ------------ Inline Spell Checking methods --------------

    Returns the inline spell checker associated with this object. The spell checker is lazily created, so this function may create the object for you during this call.

    Parameters

    • autoCreate: boolean

      If true, this will create a spell checker object if one does not exist yet for this editor. If false and the object has not been created, this function WILL RETURN NULL.

    Returns nsIInlineSpellChecker

  • Gets the modification count of the document we are editing.

    Returns

    the modification count of the document being edited. Zero means unchanged.

    Returns number

  • called each time we modify the document. Increments the modification count of the document.

    Parameters

    • aModCount: number

      the number of modifications by which to increase or decrease the count

    Returns void

  • Insert a line break into the content model. The interpretation of a break is up to the implementation: it may enter a character, split a node in the tree, etc. This may be more efficient than calling InsertText with a newline.

    Returns void

  • insertNode inserts aNode into aParent at aPosition. No checking is done to verify the legality of the insertion. That is the responsibility of the caller.

    Parameters

    • node: Node
    • parent: Node
    • aPosition: number

      The place in aParent to insert the new node 0=first child, 1=second child, etc. any number > number of current children = last child

    Returns void

  • Inserts a string at the current location, given by the selection. If the selection is not collapsed, the selection is deleted and the insertion takes place at the resulting collapsed selection.

    Parameters

    • aStringToInsert: string

    Returns void

  • mask() is available only when the editor is a password field. This masks all unmasked characters immediately.

    Returns void

  • ------------ Output methods --------------

    Output methods: aFormatType is a mime type, like text/plain.

    Parameters

    • formatType: string
    • flags: number

    Returns string

  • paste the text in the OS clipboard at the cursor position, replacing the selected text (if any)

    Parameters

    • aClipboardType: number

    Returns void

  • Paste the text in |aTransferable| at the cursor position, replacing the selected text (if any).

    Parameters

    • aTransferable: nsITransferable

    Returns void

  • Redo the topmost transaction in the redo stack. This may throw exception when this is called while editor is handling transactions.

    Returns void

  • removeAttribute() deletes aAttribute from the attribute list of aElement. If aAttribute is not an attribute of aElement, nothing is done.

    Parameters

    • aElement: Element

      the content element to operate on

    • aAttribute: string

      the string representation of the attribute to get

    Returns void

  • Parameters

    • element: Element
    • sourceAttrName: string
    • aSuppressTransaction: boolean

    Returns void

  • Remove a DocumentStateListener to the editors list of doc state listeners.

    Parameters

    • listener: nsIDocumentStateListener

    Returns void

  • Remove an EditActionListener from the editor's list of listeners.

    Parameters

    • listener: nsIEditActionListener

    Returns void

  • to be used ONLY when we need to override the doc's modification state (such as when it's saved).

    Returns void

  • ------------ Selection methods --------------

    sets the document selection to the entire contents of the document

    Returns void

  • ------------ Node manipulation methods --------------

    setAttribute() sets the attribute of aElement. No checking is done to see if aAttribute is a legal attribute of the node, or if aValue is a legal value of aAttribute.

    Parameters

    • aElement: Element

      the content element to operate on

    • attributestr: string
    • attvalue: string

    Returns void

  • Parameters

    • element: Element
    • sourceAttrName: string
    • sourceAttrValue: string
    • aSuppressTransaction: boolean

    Returns void

  • While setting the flag with this method to false, DeleteRangeTransaction, DeleteTextTransaction, InsertNodeTransaction, InsertTextTransaction and SplitNodeTransaction won't change Selection after modifying the DOM tree. Note that calling this with false does not guarantee that Selection won't be changed because other transaction may ignore this flag, editor itself may change selection, and current selection may become invalid after changing the DOM tree, etc. After calling this method with true, the caller should guarantee that Selection should be positioned where user expects.

    Parameters

    • should: boolean

      false if you don't want above transactions to modify Selection automatically after modifying the DOM tree. Note that calling this with false does not guarantee that Selection is never changed.

    Returns void

  • Called when the user manually overrides the spellchecking state for this editor.

    Parameters

    • enable: boolean

      The new state of spellchecking in this editor, as requested by the user.

    Returns void

  • Undo the topmost transaction in the undo stack. This may throw exception when this is called while editor is handling transactions.

    Returns void

  • Undo all transactions in the undo stack. This may throw exception when this is called while editor is handling transactions.

    Returns void

  • unmask() is available only when the editor is a passwrod field. This unmasks characters in specified by aStart and aEnd. If there have already unmasked characters, they are masked when this is called. Note that if you calls this without non-zero aTimeout, you bear responsibility for masking password with calling mask(). I.e., user inputting password won't be masked automacitally. If user types a new character and echo is enabled, unmasked range is expanded to including it.

    Parameters

    • aStart: number

      Optional, first index to show the character. If you specify middle of a surrogate pair, this expands the range to include the prceding high surrogate automatically. If omitted, it means that all characters of the password becomes unmasked.

    • aEnd: number

      Optional, next index of last unmasked character. If you specify middle of a surrogate pair, the expands the range to include the following low surrogate. If omitted or negative value, it means unmasking all characters after aStart. Specifying same index throws an exception.

    • aTimeout: number

      Optional, specify milliseconds to hide the unmasked characters if you want to show them temporarily. If omitted or 0, it means this won't mask the characters automatically.

    Returns void

Generated using TypeDoc