Source code

Revision control

Other Tools

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/. */
5
6
#include "nsISupports.idl"
7
#include "domstubs.idl"
8
9
webidl CharacterData;
10
webidl Node;
11
webidl Selection;
12
13
/*
14
Editor Action Listener interface to outside world
15
*/
16
17
18
/**
19
* A generic editor action listener interface.
20
* <P>
21
* nsIEditActionListener is the interface used by applications wishing to be notified
22
* when the editor modifies the DOM tree.
23
*
24
* Note: this is the wrong class to implement if you are interested in generic
25
* change notifications. For generic notifications, you should implement
26
* nsIDocumentObserver.
27
*/
28
[scriptable, uuid(b22907b1-ee93-11d2-8d50-000064657374)]
29
interface nsIEditActionListener : nsISupports
30
{
31
/**
32
* Called after the editor creates a node.
33
* @param aTag The tag name of the DOM Node to create.
34
* @param aNewNode The DOM Node that was created.
35
* @param aResult The result of the create node operation.
36
*/
37
void DidCreateNode(in AString aTag,
38
in Node aNewNode,
39
in nsresult aResult);
40
41
/**
42
* Called after the editor inserts a node.
43
* @param aNode The DOM Node to insert.
44
* @param aResult The result of the insert node operation.
45
*/
46
void DidInsertNode(in Node aNode,
47
in nsresult aResult);
48
49
/**
50
* Called after the editor deletes a node.
51
* @param aChild The node to delete
52
* @param aResult The result of the delete node operation.
53
*/
54
void DidDeleteNode(in Node aChild, in nsresult aResult);
55
56
/**
57
* Called after the editor splits a node.
58
* @param aExistingRightNode The node which was split. It will become the
59
* next sibling of the new left node.
60
* @param aNewLeftNode The new node resulting from the split, becomes
61
* the previous sibling of aExistingRightNode.
62
*/
63
void DidSplitNode(in Node aExistingRightNode,
64
in Node aNewLeftNode);
65
66
/**
67
* Called after the editor joins 2 nodes.
68
* @param aLeftNode This node will be merged into the right node
69
* @param aRightNode The node that will be merged into.
70
* There is no requirement that the two nodes be of
71
* the same type.
72
* @param aParent The parent of aRightNode
73
* @param aResult The result of the join operation.
74
*/
75
void DidJoinNodes(in Node aLeftNode,
76
in Node aRightNode,
77
in Node aParent,
78
in nsresult aResult);
79
80
/**
81
* Called after the editor inserts text.
82
* @param aTextNode This node getting inserted text.
83
* @param aOffset The offset in aTextNode to insert at.
84
* @param aString The string that gets inserted.
85
* @param aResult The result of the insert text operation.
86
*/
87
void DidInsertText(in CharacterData aTextNode,
88
in long aOffset,
89
in AString aString,
90
in nsresult aResult);
91
92
/**
93
* Called before the editor deletes text.
94
* @param aTextNode This node getting text deleted.
95
* @param aOffset The offset in aTextNode to delete at.
96
* @param aLength The amount of text to delete.
97
*/
98
void WillDeleteText(in CharacterData aTextNode,
99
in long aOffset,
100
in long aLength);
101
102
/**
103
* Called before the editor deletes text.
104
* @param aTextNode This node getting text deleted.
105
* @param aOffset The offset in aTextNode to delete at.
106
* @param aLength The amount of text to delete.
107
* @param aResult The result of the delete text operation.
108
*/
109
void DidDeleteText(in CharacterData aTextNode,
110
in long aOffset,
111
in long aLength,
112
in nsresult aResult);
113
114
/**
115
* Called before the editor deletes the selection.
116
* @param aSelection The selection to be deleted
117
*/
118
void WillDeleteSelection(in Selection aSelection);
119
120
/**
121
* Called after the editor deletes the selection.
122
* @param aSelection The selection, after deletion
123
*/
124
void DidDeleteSelection(in Selection aSelection);
125
};