2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "domstubs.idl"
|
|
|
|
|
2003-07-18 23:03:34 +04:00
|
|
|
interface nsIAtom;
|
2011-08-12 23:12:45 +04:00
|
|
|
interface nsIContent;
|
2001-08-08 01:39:07 +04:00
|
|
|
interface nsISupportsArray;
|
2003-06-25 12:50:48 +04:00
|
|
|
interface nsISelection;
|
2003-04-15 18:00:08 +04:00
|
|
|
interface nsIContentFilter;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
%{C++
|
2012-05-06 11:53:11 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
}
|
|
|
|
}
|
2001-03-28 03:11:08 +04:00
|
|
|
%}
|
2012-05-06 11:53:11 +04:00
|
|
|
|
|
|
|
[ptr] native Element (mozilla::dom::Element);
|
|
|
|
|
2014-08-28 18:33:35 +04:00
|
|
|
[scriptable, uuid(393a364f-e8e2-48a1-a271-a0067b6bac9b)]
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
interface nsIHTMLEditor : nsISupports
|
|
|
|
{
|
|
|
|
%{C++
|
|
|
|
typedef short EAlignment;
|
|
|
|
%}
|
|
|
|
|
|
|
|
// used by GetAlignment()
|
|
|
|
const short eLeft = 0;
|
|
|
|
const short eCenter = 1;
|
|
|
|
const short eRight = 2;
|
|
|
|
const short eJustify = 3;
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Inline property methods -------------- */
|
|
|
|
|
|
|
|
|
2003-06-03 02:21:06 +04:00
|
|
|
/**
|
|
|
|
* AddDefaultProperty() registers a default style property with the editor
|
|
|
|
*
|
|
|
|
* @param aProperty the property to set by default
|
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
|
|
|
* Example: aProperty="font", aAttribute="color"
|
|
|
|
* @param aValue if aAttribute is not null, the value of the attribute.
|
|
|
|
* Example: aProperty="font", aAttribute="color",
|
|
|
|
* aValue="0x00FFFF"
|
|
|
|
*/
|
|
|
|
void addDefaultProperty(in nsIAtom aProperty,
|
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RemoveDefaultProperty() unregisters a default style property with the editor
|
|
|
|
*
|
|
|
|
* @param aProperty the property to remove from defaults
|
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
|
|
|
* Example: aProperty="font", aAttribute="color"
|
|
|
|
* @param aValue if aAttribute is not null, the value of the attribute.
|
|
|
|
* Example: aProperty="font", aAttribute="color",
|
|
|
|
* aValue="0x00FFFF"
|
|
|
|
*/
|
|
|
|
void removeDefaultProperty(in nsIAtom aProperty,
|
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RemoveAllDefaultProperties() unregisters all default style properties with the editor
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void removeAllDefaultProperties();
|
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/**
|
|
|
|
* SetInlineProperty() sets the aggregate properties on the current selection
|
|
|
|
*
|
|
|
|
* @param aProperty the property to set on the selection
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
2001-03-28 03:11:08 +04:00
|
|
|
* Example: aProperty="font", aAttribute="color"
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aValue if aAttribute is not null, the value of the attribute.
|
|
|
|
* May be null.
|
|
|
|
* Example: aProperty="font", aAttribute="color",
|
|
|
|
* aValue="0x00FFFF"
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setInlineProperty(in nsIAtom aProperty,
|
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getInlineProperty() gets aggregate properties of the current selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* All object in the current selection are scanned and their attributes are
|
|
|
|
* represented in a list of Property object.
|
|
|
|
*
|
|
|
|
* @param aProperty the property to get on the selection
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
2001-03-28 03:11:08 +04:00
|
|
|
* Example: aProperty="font", aAttribute="color"
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aValue if aAttribute is not null, the value of the attribute.
|
|
|
|
* May be null.
|
|
|
|
* Example: aProperty="font", aAttribute="color",
|
|
|
|
* aValue="0x00FFFF"
|
2012-10-25 20:32:24 +04:00
|
|
|
* @param aFirst [OUT] PR_TRUE if the first text node in the
|
2002-03-15 01:11:14 +03:00
|
|
|
* selection has the property
|
2012-10-25 20:32:24 +04:00
|
|
|
* @param aAny [OUT] PR_TRUE if any of the text nodes in the
|
2002-03-15 01:11:14 +03:00
|
|
|
* selection have the property
|
2012-10-25 20:32:24 +04:00
|
|
|
* @param aAll [OUT] PR_TRUE if all of the text nodes in the
|
2002-03-15 01:11:14 +03:00
|
|
|
* selection have the property
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void getInlineProperty(in nsIAtom aProperty,
|
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue,
|
|
|
|
out boolean aFirst,
|
|
|
|
out boolean aAny,
|
|
|
|
out boolean aAll);
|
|
|
|
|
|
|
|
AString getInlinePropertyWithAttrValue(in nsIAtom aProperty,
|
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue,
|
|
|
|
out boolean aFirst,
|
|
|
|
out boolean aAny,
|
|
|
|
out boolean aAll);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* removeAllInlineProperties() deletes all the inline properties from all
|
2001-03-28 03:11:08 +04:00
|
|
|
* text in the current selection.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void removeAllInlineProperties();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* removeInlineProperty() deletes the properties from all text in the current
|
|
|
|
* selection. If aProperty is not set on the selection, nothing is done.
|
2001-03-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
* @param aProperty the property to remove from the selection
|
2002-03-15 01:11:14 +03:00
|
|
|
* All atoms are for normal HTML tags (e.g.:
|
|
|
|
* nsIEditorProperty::font) except when you want to
|
|
|
|
* remove just links and not named anchors.
|
|
|
|
* For that, use nsIEditorProperty::href
|
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
|
|
|
* Example: aProperty=nsIEditorProptery::font,
|
|
|
|
* aAttribute="color"
|
|
|
|
* nsIEditProperty::allAttributes is special.
|
|
|
|
* It indicates that all content-based text properties
|
|
|
|
* are to be removed from the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void removeInlineProperty(in nsIAtom aProperty, in AString aAttribute);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Increase font size for text in selection by 1 HTML unit
|
|
|
|
* All existing text is scanned for existing <FONT SIZE> attributes
|
2002-03-15 01:11:14 +03:00
|
|
|
* so they will be incremented instead of inserting new <FONT> tag
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void increaseFontSize();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decrease font size for text in selection by 1 HTML unit
|
|
|
|
* All existing text is scanned for existing <FONT SIZE> attributes
|
2002-03-15 01:11:14 +03:00
|
|
|
* so they will be decreased instead of inserting new <FONT> tag
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void decreaseFontSize();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/* ------------ HTML content methods -------------- */
|
|
|
|
|
2001-04-07 04:45:26 +04:00
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* Tests if a node is a BLOCK element according the the HTML 4.0 DTD.
|
2001-04-07 04:45:26 +04:00
|
|
|
* This does NOT consider CSS effect on display type
|
|
|
|
*
|
|
|
|
* @param aNode the node to test
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
boolean nodeIsBlock(in nsIDOMNode node);
|
2001-04-07 04:45:26 +04:00
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/**
|
|
|
|
* Insert some HTML source at the current location
|
|
|
|
*
|
|
|
|
* @param aInputString the string to be inserted
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void insertHTML(in AString aInputString);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
|
|
|
* Paste the text in the OS clipboard at the cursor position, replacing
|
|
|
|
* the selected text (if any), but strip out any HTML styles and formatting
|
|
|
|
*/
|
|
|
|
void pasteNoFormatting(in long aSelectionType);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rebuild the entire document from source HTML
|
2001-03-28 03:11:08 +04:00
|
|
|
* Needed to be able to edit HEAD and other outside-of-BODY content
|
|
|
|
*
|
|
|
|
* @param aSourceString HTML source string of the entire new document
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void rebuildDocumentFromSource(in AString aSourceString);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert some HTML source, interpreting
|
2003-06-12 18:51:37 +04:00
|
|
|
* the string argument according to the given context.
|
2001-03-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
* @param aInputString the string to be inserted
|
2003-04-15 18:00:08 +04:00
|
|
|
* @param aContextStr Context of insertion
|
|
|
|
* @param aInfoStr Related info to aInputString
|
|
|
|
* @param aFlavor Transferable flavor, can be ""
|
2003-06-10 22:52:31 +04:00
|
|
|
* @param aSourceDoc document where input was dragged from (may be null)
|
2003-04-15 18:00:08 +04:00
|
|
|
* @param aDestinationNode location for insertion (such as when dropped)
|
|
|
|
* @param aDestinationOffset used with aDestNode to determine insert location
|
|
|
|
* @param aDeleteSelection used with aDestNode during drag&drop
|
|
|
|
* @param aCollapseSelection used with aDestNode during drag&drop
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2003-06-12 18:51:37 +04:00
|
|
|
void insertHTMLWithContext(in AString aInputString,
|
|
|
|
in AString aContextStr,
|
|
|
|
in AString aInfoStr,
|
|
|
|
in AString aFlavor,
|
|
|
|
in nsIDOMDocument aSourceDoc,
|
|
|
|
in nsIDOMNode aDestinationNode,
|
|
|
|
in long aDestinationOffset,
|
|
|
|
in boolean aDeleteSelection);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
|
|
|
* Insert an element, which may have child nodes, at the selection
|
2001-03-28 03:11:08 +04:00
|
|
|
* Used primarily to insert a new element for various insert element dialogs,
|
|
|
|
* but it enforces the HTML 4.0 DTD "CanContain" rules, so it should
|
|
|
|
* be useful for other elements.
|
|
|
|
*
|
|
|
|
* @param aElement The element to insert
|
|
|
|
* @param aDeleteSelection Delete the selection before inserting
|
2012-10-25 20:32:24 +04:00
|
|
|
* If aDeleteSelection is PR_FALSE, then the element is inserted
|
2001-03-28 03:11:08 +04:00
|
|
|
* after the end of the selection for all element except
|
|
|
|
* Named Anchors, which insert before the selection
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void insertElementAtSelection(in nsIDOMElement aElement,
|
|
|
|
in boolean aDeleteSelection);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-11-27 03:35:09 +03:00
|
|
|
/**
|
|
|
|
* Set the documents title.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setDocumentTitle(in AString aTitle);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-11-27 03:35:09 +03:00
|
|
|
/**
|
|
|
|
* Set the BaseURL for the document to the current URL
|
|
|
|
* but only if the page doesn't have a <base> tag
|
|
|
|
* This should be done after the document URL has changed,
|
|
|
|
* such as after saving a file
|
|
|
|
* This is used as base for relativizing link and image urls
|
|
|
|
*/
|
|
|
|
void updateBaseURL();
|
|
|
|
|
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/* ------------ Selection manipulation -------------- */
|
|
|
|
/* Should these be moved to nsISelection? */
|
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
|
|
|
* Set the selection at the suppled element
|
2001-03-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
* @param aElement An element in the document
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void selectElement(in nsIDOMElement aElement);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
|
|
|
* Create a collapsed selection just after aElement
|
2001-03-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
* XXX could we parameterize SelectElement(before/select/after>?
|
|
|
|
*
|
|
|
|
* The selection is set to parent-of-aElement with an
|
|
|
|
* offset 1 greater than aElement's offset
|
|
|
|
* but it enforces the HTML 4.0 DTD "CanContain" rules, so it should
|
|
|
|
* be useful for other elements.
|
|
|
|
*
|
|
|
|
* @param aElement An element in the document
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setCaretAfterElement(in nsIDOMElement aElement);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SetParagraphFormat Insert a block paragraph tag around selection
|
|
|
|
* @param aParagraphFormat "p", "h1" to "h6", "address", "pre", or "blockquote"
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setParagraphFormat(in AString aParagraphFormat);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getParagraphState returns what block tag paragraph format is in
|
|
|
|
* the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one format
|
2002-03-15 01:11:14 +03:00
|
|
|
* @return Name of block tag. "" is returned for none.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
AString getParagraphState(out boolean aMixed);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getFontFaceState returns what font face is in the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one font face
|
2002-03-15 01:11:14 +03:00
|
|
|
* @return Name of face. Note: "tt" is returned for
|
2001-03-28 03:11:08 +04:00
|
|
|
* tt tag. "" is returned for none.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
AString getFontFaceState(out boolean aMixed);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getFontColorState returns what font face is in the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one font color
|
2002-03-15 01:11:14 +03:00
|
|
|
* @return Color string. "" is returned for none.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
AString getFontColorState(out boolean aMixed);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getFontColorState returns what font face is in the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one font color
|
2002-03-15 01:11:14 +03:00
|
|
|
* @return Color string. "" is returned for none.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
AString getBackgroundColorState(out boolean aMixed);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-01-09 16:51:37 +03:00
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getHighlightColorState returns what the highlight color of the selection.
|
2002-01-09 16:51:37 +03:00
|
|
|
* @param aMixed True if there is more than one font color
|
2002-03-15 01:11:14 +03:00
|
|
|
* @return Color string. "" is returned for none.
|
2002-01-09 16:51:37 +03:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
AString getHighlightColorState(out boolean aMixed);
|
2002-01-09 16:51:37 +03:00
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getListState returns what list type is in the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one type of list, or
|
|
|
|
* if there is some list and non-list
|
|
|
|
* @param aOL The company that employs me. No, really, it's
|
|
|
|
* true if an "ol" list is selected.
|
|
|
|
* @param aUL true if an "ul" list is selected.
|
|
|
|
* @param aDL true if a "dl" list is selected.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void getListState(out boolean aMixed, out boolean aOL, out boolean aUL,
|
|
|
|
out boolean aDL);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getListItemState returns what list item type is in the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one type of list item, or
|
|
|
|
* if there is some list and non-list
|
|
|
|
* @param aLI true if "li" list items are selected.
|
|
|
|
* @param aDT true if "dt" list items are selected.
|
|
|
|
* @param aDD true if "dd" list items are selected.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void getListItemState(out boolean aMixed, out boolean aLI,
|
|
|
|
out boolean aDT, out boolean aDD);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getAlignment returns what alignment is in the selection.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aMixed True if there is more than one type of list item, or
|
|
|
|
* if there is some list and non-list
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aAlign enum value for first encountered alignment
|
|
|
|
* (left/center/right)
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void getAlignment(out boolean aMixed, out short aAlign);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Document me!
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void getIndentState(out boolean aCanIndent, out boolean aCanOutdent);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Document me!
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void makeOrChangeList(in AString aListType, in boolean entireList,
|
|
|
|
in AString aBulletType);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Document me!
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void removeList(in AString aListType);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Document me!
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void indent(in AString aIndent);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Document me!
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void align(in AString aAlign);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Return the input node or a parent matching the given aTagName,
|
|
|
|
* starting the search at the supplied node.
|
|
|
|
* An example of use is for testing if a node is in a table cell
|
|
|
|
* given a selection anchor node.
|
|
|
|
*
|
|
|
|
* @param aTagName The HTML tagname
|
|
|
|
* Special input values:
|
|
|
|
* Use "href" to get a link node
|
|
|
|
* (an "A" tag with the "href" attribute set)
|
|
|
|
* Use "anchor" or "namedanchor" to get a named anchor node
|
|
|
|
* (an "A" tag with the "name" attribute set)
|
|
|
|
* Use "list" to get an OL, UL, or DL list node
|
|
|
|
* Use "td" to get either a TD or TH cell node
|
|
|
|
*
|
|
|
|
* @param aNode The node in the document to start the search.
|
|
|
|
* If it is null, the anchor node of the current selection is used.
|
|
|
|
* @return NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
|
|
|
* (passes NS_SUCCEEDED macro)
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
nsIDOMElement getElementOrParentByTagName(in AString aTagName,
|
|
|
|
in nsIDOMNode aNode);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Return an element only if it is the only node selected,
|
|
|
|
* such as an image, horizontal rule, etc.
|
|
|
|
* The exception is a link, which is more like a text attribute:
|
|
|
|
* The Anchor tag is returned if the selection is within the textnode(s)
|
|
|
|
* that are children of the "A" node.
|
|
|
|
* This could be a collapsed selection, i.e., a caret
|
|
|
|
* within the link text.
|
|
|
|
*
|
|
|
|
* @param aTagName The HTML tagname or and empty string
|
|
|
|
* to get any element (but only if it is the only element selected)
|
|
|
|
* Special input values for Links and Named anchors:
|
|
|
|
* Use "href" to get a link node
|
|
|
|
* (an "A" tag with the "href" attribute set)
|
|
|
|
* Use "anchor" or "namedanchor" to get a named anchor node
|
|
|
|
* (an "A" tag with the "name" attribute set)
|
|
|
|
* @return NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
|
|
|
* (passes NS_SUCCEEDED macro)
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
nsIDOMElement getSelectedElement(in AString aTagName);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Output the contents of the <HEAD> section as text/HTML format
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
AString getHeadContentsAsHTML();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Replace all children of <HEAD> with string of HTML source
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void replaceHeadContentsWithHTML(in AString aSourceToInsert);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Return a new element with default attribute values
|
|
|
|
*
|
|
|
|
* This does not rely on the selection, and is not sensitive to context.
|
|
|
|
*
|
|
|
|
* Used primarily to supply new element for various insert element dialogs
|
|
|
|
* (Image, Link, NamedAnchor, Table, and HorizontalRule
|
|
|
|
* are the only returned elements as of 7/25/99)
|
|
|
|
*
|
|
|
|
* @param aTagName The HTML tagname
|
|
|
|
* Special input values for Links and Named anchors:
|
|
|
|
* Use "href" to get a link node
|
|
|
|
* (an "A" tag with the "href" attribute set)
|
|
|
|
* Use "anchor" or "namedanchor" to get a named anchor node
|
|
|
|
* (an "A" tag with the "name" attribute set)
|
|
|
|
* @return The new element created.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
nsIDOMElement createElementWithDefaults(in AString aTagName);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Insert an link element as the parent of the current selection
|
|
|
|
*
|
|
|
|
* @param aElement An "A" element with a non-empty "href" attribute
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void insertLinkAroundSelection(in nsIDOMElement aAnchorElement);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Set the value of the "bgcolor" attribute on the document's <body> element
|
|
|
|
*
|
|
|
|
* @param aColor The HTML color string, such as "#ffccff" or "yellow"
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setBackgroundColor(in AString aColor);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* Set an attribute on the document's <body> element
|
|
|
|
* such as text, link, background colors
|
|
|
|
*
|
|
|
|
* 8/31/00 THIS ISN'T BEING USED? SHOULD WE DROP IT?
|
|
|
|
*
|
|
|
|
* @param aAttr The attribute to be set
|
|
|
|
* @param aValue The value of the attribute
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setBodyAttribute(in AString aAttr, in AString aValue);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2001-08-08 01:39:07 +04:00
|
|
|
/**
|
|
|
|
* Find all the nodes in the document which contain references
|
|
|
|
* to outside URIs (e.g. a href, img src, script src, etc.)
|
|
|
|
* The objects in the array will be type nsIURIRefObject.
|
|
|
|
*
|
|
|
|
* @return aNodeList the linked nodes found
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
nsISupportsArray getLinkedObjects();
|
2002-01-09 16:51:37 +03:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
/**
|
2003-06-25 12:50:48 +04:00
|
|
|
* A boolean which is true is the HTMLEditor has been instantiated
|
|
|
|
* with CSS knowledge and if the CSS pref is currently checked
|
|
|
|
*
|
|
|
|
* @return true if CSS handled and enabled
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
attribute boolean isCSSEnabled;
|
2002-01-25 13:16:52 +03:00
|
|
|
|
2003-04-15 18:00:08 +04:00
|
|
|
/**
|
|
|
|
* Add listener for insertion override
|
|
|
|
* @param inFilter function which callers want called during insertion
|
|
|
|
*/
|
|
|
|
void addInsertionListener(in nsIContentFilter inFilter);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove listener for insertion override
|
|
|
|
* @param inFilter function which callers do not want called during insertion
|
|
|
|
*/
|
|
|
|
void removeInsertionListener(in nsIContentFilter inFilter);
|
|
|
|
|
2003-06-25 12:50:48 +04:00
|
|
|
/**
|
|
|
|
* Returns an anonymous nsDOMElement of type aTag,
|
|
|
|
* child of aParentNode. If aIsCreatedHidden is true, the class
|
|
|
|
* "hidden" is added to the created element. If aAnonClass is not
|
|
|
|
* the empty string, it becomes the value of the attribute "_moz_anonclass"
|
|
|
|
* @return a DOM Element
|
|
|
|
* @param aTag [IN] a string representing the desired type of
|
|
|
|
* the element to create
|
|
|
|
* @param aParentNode [IN] the parent node of the created anonymous
|
|
|
|
* element
|
|
|
|
* @param aAnonClass [IN] contents of the _moz_anonclass attribute
|
|
|
|
* @param aIsCreatedHidden [IN] a boolean specifying if the class "hidden"
|
|
|
|
* is to be added to the created anonymous
|
|
|
|
* element
|
|
|
|
*/
|
|
|
|
nsIDOMElement createAnonymousElement(in AString aTag, in nsIDOMNode aParentNode,
|
|
|
|
in AString aAnonClass, in boolean aIsCreatedHidden);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* returns the deepest container of the selection
|
|
|
|
* @return a DOM Element
|
|
|
|
*/
|
|
|
|
nsIDOMElement getSelectionContainer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the anonymous nodes created by the HTML editor have to be
|
|
|
|
* refreshed or hidden depending on a possible new state of the selection
|
|
|
|
* @param aSelection [IN] a selection
|
|
|
|
*/
|
|
|
|
void checkSelectionStateForAnonymousButtons(in nsISelection aSelection);
|
|
|
|
|
2003-06-19 18:06:05 +04:00
|
|
|
boolean isAnonymousElement(in nsIDOMElement aElement);
|
2005-01-12 22:11:48 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A boolean indicating if a return key pressed in a paragraph creates
|
|
|
|
* another paragraph or just inserts a <br> at the caret
|
|
|
|
*
|
|
|
|
* @return true if CR in a paragraph creates a new paragraph
|
|
|
|
*/
|
|
|
|
attribute boolean returnInParagraphCreatesNewParagraph;
|
2011-03-25 18:03:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether a BR node is visible to the user.
|
|
|
|
*/
|
|
|
|
boolean breakIsVisible(in nsIDOMNode aNode);
|
2011-08-12 23:12:45 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get an active editor's editing host in DOM window. If this editor isn't
|
|
|
|
* active in the DOM window, this returns NULL.
|
|
|
|
*/
|
2012-05-06 11:53:11 +04:00
|
|
|
[noscript, notxpcom] Element GetActiveEditingHost();
|
2001-03-28 03:11:08 +04:00
|
|
|
};
|
|
|
|
|