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"
8 [scriptable
, uuid(b74fb158
-1265-4102-91eb
-edd0136b49f8
)]
9 interface nsIPlaintextEditor
: nsISupports
12 // XXX Why aren't these in nsIEditor?
13 // only plain text entry is allowed via events
14 const long eEditorPlaintextMask
= 0x0001;
15 // enter key and CR-LF handled specially
16 const long eEditorSingleLineMask
= 0x0002;
17 // text is not entered into content, only a representative character
18 const long eEditorPasswordMask
= 0x0004;
19 // editing events are disabled. Editor may still accept focus.
20 const long eEditorReadonlyMask
= 0x0008;
21 // all events are disabled (like scrolling). Editor will not accept focus.
22 const long eEditorDisabledMask
= 0x0010;
23 // text input is limited to certain character types, use mFilter
24 const long eEditorFilterInputMask
= 0x0020;
25 // use mail-compose editing rules
26 const long eEditorMailMask
= 0x0040;
27 // allow the editor to set font: monospace on the root node
28 const long eEditorEnableWrapHackMask
= 0x0080;
29 // bit for widgets (form elements)
30 const long eEditorWidgetMask
= 0x0100;
31 // this HTML editor should not create css styles
32 const long eEditorNoCSSMask
= 0x0200;
33 // whether HTML document specific actions are executed or not.
34 // e.g., if this flag is set, the editor doesn't handle Tab key.
35 // besides, anchors of HTML are not clickable.
36 const long eEditorAllowInteraction
= 0x0400;
37 // when this is set, the characters in password editor are always masked.
38 // see bug 530367 for the detail.
39 const long eEditorDontEchoPassword
= 0x0800;
40 // when this flag is set, the internal direction of the editor is RTL.
41 // if neither of the direction flags are set, the direction is determined
42 // from the text control's content node.
43 const long eEditorRightToLeft
= 0x1000;
44 // when this flag is set, the internal direction of the editor is LTR.
45 const long eEditorLeftToRight
= 0x2000;
46 // when this flag is set, the editor's text content is not spell checked.
47 const long eEditorSkipSpellCheck
= 0x4000;
50 * The valid values for newlines handling.
51 * Can't change the values unless we remove
54 const long eNewlinesPasteIntact
= 0;
55 const long eNewlinesPasteToFirst
= 1;
56 const long eNewlinesReplaceWithSpaces
= 2;
57 const long eNewlinesStrip
= 3;
58 const long eNewlinesReplaceWithCommas
= 4;
59 const long eNewlinesStripSurroundingWhitespace
= 5;
62 * The length of the contents in characters.
63 * XXX change this type to 'unsigned long'
65 readonly attribute
long textLength
;
68 * The maximum number of characters allowed.
69 * default: -1 (unlimited).
71 attribute
long maxTextLength
;
73 /** Get and set the body wrap width.
76 * 0 = wrap to window width
79 attribute
long wrapWidth
;
82 * Similar to the setter for wrapWidth, but just sets the editor
83 * internal state without actually changing the content being edited
84 * to wrap at that column. This should only be used by callers who
85 * are sure that their content is already set up correctly.
87 void setWrapColumn
(in long aWrapColumn
);
89 /** Get and set newline handling.
91 * Values are the constants defined above.
93 attribute
long newlineHandling
;
96 * Inserts a string at the current location,
97 * given by the selection.
98 * If the selection is not collapsed, the selection is deleted
99 * and the insertion takes place at the resulting collapsed selection.
101 * @param aString the string to be inserted
103 void insertText
(in DOMString aStringToInsert
);
106 * Insert a line break into the content model.
107 * The interpretation of a break is up to the implementation:
108 * it may enter a character, split a node in the tree, etc.
109 * This may be more efficient than calling InsertText with a newline.
111 void insertLineBreak
();