1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
7 #include
"domstubs.idl"
9 interface nsISelection
;
13 Editor Action Listener interface to outside world
18 * A generic editor action listener interface.
20 * nsIEditActionListener is the interface used by applications wishing to be notified
21 * when the editor modifies the DOM tree.
23 * Note: this is the wrong class to implement if you are interested in generic
24 * change notifications. For generic notifications, you should implement
25 * nsIDocumentObserver.
27 [scriptable
, uuid(b22907b1
-ee93
-11d2
-8d50
-000064657374)]
29 interface nsIEditActionListener
: nsISupports
{
32 * Called before the editor creates a node.
33 * @param aTag The tag name of the DOM Node to create.
34 * @param aParent The node to insert the new object into
35 * @param aPosition The place in aParent to insert the new node
36 * 0=first child, 1=second child, etc.
37 * any number > number of current children = last child
39 void WillCreateNode
(in DOMString aTag
,
40 in nsIDOMNode aParent
,
44 * Called after the editor creates a node.
45 * @param aTag The tag name of the DOM Node to create.
46 * @param aNode The DOM Node that was created.
47 * @param aParent The node to insert the new object into
48 * @param aPosition The place in aParent to insert the new node
49 * 0=first child, 1=second child, etc.
50 * any number > number of current children = last child
51 * @param aResult The result of the create node operation.
53 void DidCreateNode
(in DOMString aTag
,
55 in nsIDOMNode aParent
,
60 * Called before the editor inserts a node.
61 * @param aNode The DOM Node to insert.
62 * @param aParent The node to insert the new object into
63 * @param aPosition The place in aParent to insert the new node
64 * 0=first child, 1=second child, etc.
65 * any number > number of current children = last child
67 void WillInsertNode
(in nsIDOMNode aNode
,
68 in nsIDOMNode aParent
,
72 * Called after the editor inserts a node.
73 * @param aNode The DOM Node to insert.
74 * @param aParent The node to insert the new object into
75 * @param aPosition The place in aParent to insert the new node
76 * 0=first child, 1=second child, etc.
77 * any number > number of current children = last child
78 * @param aResult The result of the insert node operation.
80 void DidInsertNode
(in nsIDOMNode aNode
,
81 in nsIDOMNode aParent
,
86 * Called before the editor deletes a node.
87 * @param aChild The node to delete
89 void WillDeleteNode
(in nsIDOMNode aChild
);
92 * Called after the editor deletes a node.
93 * @param aChild The node to delete
94 * @param aResult The result of the delete node operation.
96 void DidDeleteNode
(in nsIDOMNode aChild
, in nsresult aResult
);
99 * Called before the editor splits a node.
100 * @param aExistingRightNode the node to split. It will become the new node's next sibling.
101 * @param aOffset the offset of aExistingRightNode's content|children to do the split at
102 * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
104 void WillSplitNode
(in nsIDOMNode aExistingRightNode
,
108 * Called after the editor splits a node.
109 * @param aExistingRightNode the node to split. It will become the new node's next sibling.
110 * @param aOffset the offset of aExistingRightNode's content|children to do the split at
111 * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
113 void DidSplitNode
(in nsIDOMNode aExistingRightNode
,
115 in nsIDOMNode aNewLeftNode
,
116 in nsresult aResult
);
119 * Called before the editor joins 2 nodes.
120 * @param aLeftNode This node will be merged into the right node
121 * @param aRightNode The node that will be merged into.
122 * There is no requirement that the two nodes be of
124 * @param aParent The parent of aRightNode
126 void WillJoinNodes
(in nsIDOMNode aLeftNode
,
127 in nsIDOMNode aRightNode
,
128 in nsIDOMNode aParent
);
131 * Called after the editor joins 2 nodes.
132 * @param aLeftNode This node will be merged into the right node
133 * @param aRightNode The node that will be merged into.
134 * There is no requirement that the two nodes be of
136 * @param aParent The parent of aRightNode
137 * @param aResult The result of the join operation.
139 void DidJoinNodes
(in nsIDOMNode aLeftNode
,
140 in nsIDOMNode aRightNode
,
141 in nsIDOMNode aParent
,
142 in nsresult aResult
);
145 * Called before the editor inserts text.
146 * @param aTextNode This node getting inserted text
147 * @param aOffset The offset in aTextNode to insert at.
148 * @param aString The string that gets inserted.
150 void WillInsertText
(in nsIDOMCharacterData aTextNode
,
152 in DOMString aString
);
155 * Called after the editor inserts text.
156 * @param aTextNode This node getting inserted text
157 * @param aOffset The offset in aTextNode to insert at.
158 * @param aString The string that gets inserted.
159 * @param aResult The result of the insert text operation.
161 void DidInsertText
(in nsIDOMCharacterData aTextNode
,
163 in DOMString aString
,
164 in nsresult aResult
);
167 * Called before the editor deletes text.
168 * @param aTextNode This node getting text deleted
169 * @param aOffset The offset in aTextNode to delete at.
170 * @param aLength The amount of text to delete.
172 void WillDeleteText
(in nsIDOMCharacterData aTextNode
,
177 * Called before the editor deletes text.
178 * @param aTextNode This node getting text deleted
179 * @param aOffset The offset in aTextNode to delete at.
180 * @param aLength The amount of text to delete.
181 * @param aResult The result of the delete text operation.
183 void DidDeleteText
(in nsIDOMCharacterData aTextNode
,
186 in nsresult aResult
);
189 * Called before the editor deletes the selection.
190 * @param aSelection The selection to be deleted
192 void WillDeleteSelection
(in nsISelection aSelection
);
195 * Called after the editor deletes the selection.
196 * @param aSelection The selection, after deletion
198 void DidDeleteSelection
(in nsISelection aSelection
);