2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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-27 23:11:08 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "domstubs.idl"
|
|
|
|
|
2011-08-12 19:12:45 +00:00
|
|
|
interface nsIContent;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2018-05-11 17:46:15 +00:00
|
|
|
webidl Document;
|
2018-04-27 03:35:18 +00:00
|
|
|
webidl Element;
|
2018-04-27 03:35:18 +00:00
|
|
|
webidl Node;
|
2018-05-08 17:52:36 +00:00
|
|
|
webidl Selection;
|
2012-05-06 07:53:11 +00:00
|
|
|
|
2017-08-04 04:57:56 +00:00
|
|
|
[scriptable, builtinclass, uuid(87ee993e-985f-4a43-a974-0d9512da2fb0)]
|
2001-03-27 23:11:08 +00: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;
|
2015-05-28 15:58:42 +00:00
|
|
|
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/* ------------ Inline property methods -------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SetInlineProperty() sets the aggregate properties on the current selection
|
|
|
|
*
|
2015-05-28 15:58:42 +00:00
|
|
|
* @param aProperty the property to set on the selection
|
2002-03-14 22:11:14 +00:00
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
2001-03-27 23:11:08 +00:00
|
|
|
* Example: aProperty="font", aAttribute="color"
|
2002-03-14 22:11:14 +00: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-27 23:11:08 +00:00
|
|
|
*/
|
2019-03-30 11:55:29 +00:00
|
|
|
[can_run_script]
|
2017-08-25 05:40:45 +00:00
|
|
|
void setInlineProperty(in AString aProperty,
|
2002-03-14 22:11:14 +00:00
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-28 12:08:50 +00:00
|
|
|
* getInlinePropertyWithAttrValue() gets aggregate properties of the current
|
|
|
|
* selection. All object in the current selection are scanned and their
|
|
|
|
* attributes are represented in a list of Property object.
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
2015-05-28 15:58:42 +00:00
|
|
|
* @param aProperty the property to get on the selection
|
2002-03-14 22:11:14 +00:00
|
|
|
* @param aAttribute the attribute of the property, if applicable.
|
|
|
|
* May be null.
|
2001-03-27 23:11:08 +00:00
|
|
|
* Example: aProperty="font", aAttribute="color"
|
2002-03-14 22:11:14 +00: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 16:32:24 +00:00
|
|
|
* @param aFirst [OUT] PR_TRUE if the first text node in the
|
2002-03-14 22:11:14 +00:00
|
|
|
* selection has the property
|
2012-10-25 16:32:24 +00:00
|
|
|
* @param aAny [OUT] PR_TRUE if any of the text nodes in the
|
2002-03-14 22:11:14 +00:00
|
|
|
* selection have the property
|
2012-10-25 16:32:24 +00:00
|
|
|
* @param aAll [OUT] PR_TRUE if all of the text nodes in the
|
2002-03-14 22:11:14 +00:00
|
|
|
* selection have the property
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2020-04-09 10:10:34 +00:00
|
|
|
[can_run_script]
|
2017-08-25 05:40:45 +00:00
|
|
|
AString getInlinePropertyWithAttrValue(in AString aProperty,
|
|
|
|
in AString aAttribute,
|
|
|
|
in AString aValue,
|
|
|
|
out boolean aFirst,
|
|
|
|
out boolean aAny,
|
|
|
|
out boolean aAll);
|
2015-05-28 15:58:42 +00:00
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
2018-11-30 01:21:59 +00:00
|
|
|
* removeInlineProperty() removes a property which changes inline style of
|
|
|
|
* text. E.g., bold, italic, super and sub.
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
2018-11-30 01:21:59 +00:00
|
|
|
* @param aProperty Tag name whcih represents the inline style you want to
|
|
|
|
* remove. E.g., "strong", "b", etc.
|
|
|
|
* If "href", <a> element which has href attribute will be
|
|
|
|
* removed.
|
|
|
|
* If "name", <a> element which has non-empty name
|
|
|
|
* attribute will be removed.
|
|
|
|
* @param aAttribute If aProperty is "font", aAttribute should be "face",
|
|
|
|
* "size", "color" or "bgcolor".
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2019-03-30 11:55:29 +00:00
|
|
|
[can_run_script]
|
2017-08-25 05:40:45 +00:00
|
|
|
void removeInlineProperty(in AString aProperty, in AString aAttribute);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/* ------------ HTML content methods -------------- */
|
|
|
|
|
2001-04-07 00:45:26 +00:00
|
|
|
/**
|
2024-10-07 23:05:15 +00:00
|
|
|
* Tests if a node is a BLOCK element. This checks whether the computed
|
|
|
|
* style of the element is block or not.
|
2001-04-07 00:45:26 +00:00
|
|
|
*
|
|
|
|
* @param aNode the node to test
|
|
|
|
*/
|
Bug 1851951 - Make `HTMLEditor` refer computed `display` instead of the HTML default style at considering block or inline element r=m_kato
Blink [1] and WebKit [2] refers `display-outside` value when they consider whether an
element is a block or an inline.
However, our editor refers HTML default style instead. Therefore, our editor
cannot handle the following cases:
* If a container block is a non-HTML element whose `display` style is `block`.
* If a container `<div>` etc is styled as `inline` and typing `Enter` in it.
* If a container `<span>` is styled as `block` and it ends with spaces.
For making users get better result, we should follow the other browsers.
However, this is too risky change. Therefore, this patch enables new behavior
only in the Nightly channel and early beta builds to collect feedback from
testers.
The big rules of checking block vs. inline are:
* When we handle block level edit actions such as formatting block, indenting
or outdenting selection, making or removing list, we should keep referring
the HTML default style because the other browsers do so and the commands are
intended for modifying the HTML structure.
* Otherwise, we should refer the computed style of the block. However, if
working with non-connected elements, we may need a special handling that is
falling back to refer the HTML default style because `HTMLEditorDataTransfer`
work with non-connected document fragments.
* Finally, if we check visibility of collapsible white-spaces and `<br>`s, we
should refer computed style. However, in this case, we may need to treat
ancestor `inline-block`s as block too, but for siblings, we should refer only
`display-outside`.
1. https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/editing_utilities.cc;l=779;drc=31fb07c05718d671d96c227855bfe97af9e3fb20
2. https://searchfox.org/wubkat/rev/b054636fffeffa0314914a11ce39725a3057131e/Source/WebCore/editing/Editing.cpp#317
Differential Revision: https://phabricator.services.mozilla.com/D188598
2023-09-27 03:01:26 +00:00
|
|
|
[can_run_script]
|
|
|
|
boolean nodeIsBlock(in Node aNode);
|
2001-04-07 00:45:26 +00:00
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
|
|
|
* Insert some HTML source at the current location
|
|
|
|
*
|
|
|
|
* @param aInputString the string to be inserted
|
|
|
|
*/
|
2019-03-30 11:55:29 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
void insertHTML(in AString aInputString);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2002-10-06 01:23:18 +00:00
|
|
|
* Rebuild the entire document from source HTML
|
2001-03-27 23:11:08 +00:00
|
|
|
* Needed to be able to edit HEAD and other outside-of-BODY content
|
|
|
|
*
|
|
|
|
* @param aSourceString HTML source string of the entire new document
|
|
|
|
*/
|
2019-03-26 10:06:43 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
void rebuildDocumentFromSource(in AString aSourceString);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2002-10-06 01:23:18 +00:00
|
|
|
* Insert an element, which may have child nodes, at the selection
|
2001-03-27 23:11:08 +00: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
|
2015-05-28 15:58:42 +00:00
|
|
|
* If aDeleteSelection is PR_FALSE, then the element is inserted
|
2001-03-27 23:11:08 +00:00
|
|
|
* after the end of the selection for all element except
|
|
|
|
* Named Anchors, which insert before the selection
|
2015-05-28 15:58:42 +00:00
|
|
|
*/
|
2019-03-30 11:55:29 +00:00
|
|
|
[can_run_script]
|
2018-04-27 03:35:18 +00:00
|
|
|
void insertElementAtSelection(in Element aElement,
|
2002-03-14 22:11:14 +00:00
|
|
|
in boolean aDeleteSelection);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2002-11-27 00:35:09 +00: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-27 23:11:08 +00:00
|
|
|
/* ------------ Selection manipulation -------------- */
|
2018-05-08 17:52:36 +00:00
|
|
|
/* Should these be moved to Selection? */
|
2015-05-28 15:58:42 +00:00
|
|
|
|
|
|
|
/**
|
2002-10-06 01:23:18 +00:00
|
|
|
* Set the selection at the suppled element
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
|
|
|
* @param aElement An element in the document
|
|
|
|
*/
|
2019-03-26 10:09:47 +00:00
|
|
|
[can_run_script]
|
2018-04-27 03:35:18 +00:00
|
|
|
void selectElement(in Element aElement);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getParagraphState returns what block tag paragraph format is in
|
|
|
|
* the selection.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aMixed True if there is more than one format
|
2002-03-14 22:11:14 +00:00
|
|
|
* @return Name of block tag. "" is returned for none.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
AString getParagraphState(out boolean aMixed);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getFontFaceState returns what font face is in the selection.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aMixed True if there is more than one font face
|
2002-03-14 22:11:14 +00:00
|
|
|
* @return Name of face. Note: "tt" is returned for
|
2001-03-27 23:11:08 +00:00
|
|
|
* tt tag. "" is returned for none.
|
|
|
|
*/
|
2020-04-09 10:10:34 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
AString getFontFaceState(out boolean aMixed);
|
2015-05-28 15:58:42 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getHighlightColorState returns what the highlight color of the selection.
|
2002-01-09 13:51:37 +00:00
|
|
|
* @param aMixed True if there is more than one font color
|
2002-03-14 22:11:14 +00:00
|
|
|
* @return Color string. "" is returned for none.
|
2002-01-09 13:51:37 +00:00
|
|
|
*/
|
2020-04-09 10:10:34 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
AString getHighlightColorState(out boolean aMixed);
|
2002-01-09 13:51:37 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getListState returns what list type is in the selection.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aMixed True if there is more than one type of list, or
|
|
|
|
* if there is some list and non-list
|
2015-05-28 15:58:42 +00:00
|
|
|
* @param aOL The company that employs me. No, really, it's
|
2001-03-27 23:11:08 +00:00
|
|
|
* 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-14 22:11:14 +00:00
|
|
|
void getListState(out boolean aMixed, out boolean aOL, out boolean aUL,
|
|
|
|
out boolean aDL);
|
2015-05-28 15:58:42 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getListItemState returns what list item type is in the selection.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aMixed True if there is more than one type of list item, or
|
|
|
|
* if there is some list and non-list
|
2019-09-18 04:42:55 +00:00
|
|
|
* XXX This ignores `<li>` element selected state.
|
|
|
|
* For example, even if `<li>` and `<dt>` are selected,
|
|
|
|
* this is set to false.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @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-14 22:11:14 +00:00
|
|
|
void getListItemState(out boolean aMixed, out boolean aLI,
|
|
|
|
out boolean aDT, out boolean aDD);
|
2015-05-28 15:58:42 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getAlignment returns what alignment is in the selection.
|
2019-09-18 06:26:56 +00:00
|
|
|
* @param aMixed Always returns false.
|
2002-03-14 22:11:14 +00:00
|
|
|
* @param aAlign enum value for first encountered alignment
|
|
|
|
* (left/center/right)
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2020-04-09 10:10:34 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
void getAlignment(out boolean aMixed, out short aAlign);
|
2015-05-28 15:58:42 +00:00
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
|
|
|
* Document me!
|
2015-05-28 15:58:42 +00:00
|
|
|
*
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2019-05-07 22:34:28 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
void makeOrChangeList(in AString aListType, in boolean entireList,
|
|
|
|
in AString aBulletType);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2018-08-20 12:23:56 +00:00
|
|
|
* removeList removes list items (<li>, <dd>, and <dt>) and list structures
|
|
|
|
* (<ul>, <ol>, and <dl>).
|
2015-05-28 15:58:42 +00:00
|
|
|
*
|
2018-08-20 12:23:56 +00:00
|
|
|
* @param aListType Unused.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2019-09-06 06:01:57 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
void removeList(in AString aListType);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2020-04-09 10:10:36 +00:00
|
|
|
* GetElementOrParentByTagName() returns an inclusive ancestor element whose
|
|
|
|
* name matches aTagName from aNode or anchor node of Selection to <body>
|
|
|
|
* element or null if there is no element matching with aTagName.
|
2003-06-25 08:50:48 +00:00
|
|
|
*
|
Bug 1484092 - part 1: Make HTMLEditor::GetElementOrParentByTagName() use nsAtom for the tag name r=m_kato
HTMLElementOrParentByTagName() is the last user of IsLinkTag(const nsAString&)
and IsNamedAnchorTag(const nsAString&). For making their maintenance easier,
let's make GetElementOrParentByTagName() take const nsAtom& for tag name.
GetElementOrParentByTagName() has two functions, one is looking for an element
starting from a node. The other is, if the start node is nullptr, it retrieves
anchor node of Selection as start node. Therefore, this patch splits the
first part to GetElementOrParentByTagNameInternal(). Then, creates its
wrapper which retrieves anchor of Selection automatically,
GetElementOrParentByTagNameAtSelection().
Additionally, this patch makes all internal callers of HTMLEditor use
GetElementOrParentByTagNameInternal() or
GetElementOrParentByTagNameAtSelection() directly. Then, public method,
GetElementOrParentByTagName() is called only by outer classes.
Note that some callers use both GetElementOrParentByTagNameInternal()
and GetElementOrParentByTagNameAtSelection() since they don't check whether
setting node is nullptr. They may be bug of them. We should investigate
the API callers later.
Differential Revision: https://phabricator.services.mozilla.com/D3584
--HG--
extra : moz-landing-system : lando
2018-08-17 14:06:18 +00:00
|
|
|
* @param aTagName The tag name which you want to look for.
|
|
|
|
* Must not be empty string.
|
|
|
|
* If "list", the result may be <ul>, <ol> or <dl>
|
|
|
|
* element.
|
|
|
|
* If "td", the result may be <td> or <th>.
|
|
|
|
* If "href", the result may be <a> element
|
|
|
|
* which has "href" attribute with non-empty value.
|
2018-08-17 14:50:56 +00:00
|
|
|
* If "anchor", the result may be <a> which has
|
|
|
|
* "name" attribute with non-empty value.
|
Bug 1484092 - part 1: Make HTMLEditor::GetElementOrParentByTagName() use nsAtom for the tag name r=m_kato
HTMLElementOrParentByTagName() is the last user of IsLinkTag(const nsAString&)
and IsNamedAnchorTag(const nsAString&). For making their maintenance easier,
let's make GetElementOrParentByTagName() take const nsAtom& for tag name.
GetElementOrParentByTagName() has two functions, one is looking for an element
starting from a node. The other is, if the start node is nullptr, it retrieves
anchor node of Selection as start node. Therefore, this patch splits the
first part to GetElementOrParentByTagNameInternal(). Then, creates its
wrapper which retrieves anchor of Selection automatically,
GetElementOrParentByTagNameAtSelection().
Additionally, this patch makes all internal callers of HTMLEditor use
GetElementOrParentByTagNameInternal() or
GetElementOrParentByTagNameAtSelection() directly. Then, public method,
GetElementOrParentByTagName() is called only by outer classes.
Note that some callers use both GetElementOrParentByTagNameInternal()
and GetElementOrParentByTagNameAtSelection() since they don't check whether
setting node is nullptr. They may be bug of them. We should investigate
the API callers later.
Differential Revision: https://phabricator.services.mozilla.com/D3584
--HG--
extra : moz-landing-system : lando
2018-08-17 14:06:18 +00:00
|
|
|
* @param aNode If non-null, this starts to look for the result
|
|
|
|
* from it. Otherwise, i.e., null, starts from
|
|
|
|
* anchor node of Selection.
|
|
|
|
* @return If an element which matches aTagName, returns
|
|
|
|
* an Element. Otherwise, nullptr.
|
2003-06-25 08:50:48 +00:00
|
|
|
*/
|
2018-04-27 03:35:18 +00:00
|
|
|
Element getElementOrParentByTagName(in AString aTagName,
|
|
|
|
in Node aNode);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2018-11-05 11:38:10 +00:00
|
|
|
* getSelectedElement() returns a "selected" element node. "selected" means:
|
|
|
|
* - there is only one selection range
|
|
|
|
* - the range starts from an element node or in an element
|
|
|
|
* - the range ends at immediately after same element
|
|
|
|
* - and the range does not include any other element nodes.
|
|
|
|
* Additionally, only when aTagName is "href", this thinks that an <a>
|
|
|
|
* element which has non-empty "href" attribute includes the range, the
|
|
|
|
* <a> element is selected.
|
2018-01-30 04:27:59 +00:00
|
|
|
*
|
2018-11-05 11:38:10 +00:00
|
|
|
* @param aTagName Case-insensitive element name.
|
|
|
|
* If empty string, this returns any element node or null.
|
|
|
|
* If "href", this returns an <a> element which has
|
|
|
|
* non-empty "href" attribute or null.
|
|
|
|
* If "anchor", this returns an <a> element which has
|
|
|
|
* non-empty "name" attribute or null.
|
|
|
|
* Otherwise, returns an element node whose name is
|
|
|
|
* same as aTagName or null.
|
|
|
|
* @return A "selected" element.
|
2003-06-25 08:50:48 +00:00
|
|
|
*/
|
2018-01-30 04:27:59 +00:00
|
|
|
nsISupports getSelectedElement(in AString aTagName);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2003-06-25 08:50:48 +00:00
|
|
|
* Return a new element with default attribute values
|
2015-05-28 15:58:42 +00:00
|
|
|
*
|
2003-06-25 08:50:48 +00:00
|
|
|
* This does not rely on the selection, and is not sensitive to context.
|
2015-05-28 15:58:42 +00:00
|
|
|
*
|
2003-06-25 08:50:48 +00:00
|
|
|
* Used primarily to supply new element for various insert element dialogs
|
2015-05-28 15:58:42 +00:00
|
|
|
* (Image, Link, NamedAnchor, Table, and HorizontalRule
|
2003-06-25 08:50:48 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
2019-03-30 11:55:29 +00:00
|
|
|
[can_run_script]
|
2018-04-27 03:35:18 +00:00
|
|
|
Element createElementWithDefaults(in AString aTagName);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2003-06-25 08:50:48 +00:00
|
|
|
* Insert an link element as the parent of the current selection
|
|
|
|
*
|
|
|
|
* @param aElement An "A" element with a non-empty "href" attribute
|
|
|
|
*/
|
2019-03-30 11:55:29 +00:00
|
|
|
[can_run_script]
|
2018-04-27 03:35:18 +00:00
|
|
|
void insertLinkAroundSelection(in Element aAnchorElement);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2003-06-25 08:50:48 +00: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"
|
|
|
|
*/
|
2019-05-08 05:09:56 +00:00
|
|
|
[can_run_script]
|
2002-03-14 22:11:14 +00:00
|
|
|
void setBackgroundColor(in AString aColor);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2015-05-28 15:58:42 +00:00
|
|
|
/**
|
2003-06-25 08:50:48 +00: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
|
|
|
|
*/
|
2020-10-09 02:37:47 +00:00
|
|
|
[setter_can_run_script] attribute boolean isCSSEnabled;
|
2002-01-25 10:16:52 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
/**
|
2018-08-17 08:56:28 +00:00
|
|
|
* checkSelectionStateForAnonymousButtons() may refresh editing UI such as
|
|
|
|
* resizers, inline-table-editing UI, absolute positioning UI for current
|
|
|
|
* Selection and focus state. When this method shows or hides UI, the
|
|
|
|
* editor (and/or its document/window) could be broken by mutation observers.
|
|
|
|
* FYI: Current user in script is only BlueGriffon.
|
2003-06-25 08:50:48 +00:00
|
|
|
*/
|
2019-05-09 07:37:51 +00:00
|
|
|
[can_run_script]
|
2018-10-30 10:01:38 +00:00
|
|
|
void checkSelectionStateForAnonymousButtons();
|
2003-06-25 08:50:48 +00:00
|
|
|
|
2018-04-27 03:35:18 +00:00
|
|
|
boolean isAnonymousElement(in Element aElement);
|
2005-01-12 19:11:48 +00: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;
|
2001-03-27 23:11:08 +00:00
|
|
|
};
|