diff options
Diffstat (limited to 'node_modules/montage/ui/rich-text-editor.reel/rich-text-editor.js')
-rw-r--r-- | node_modules/montage/ui/rich-text-editor.reel/rich-text-editor.js | 1669 |
1 files changed, 0 insertions, 1669 deletions
diff --git a/node_modules/montage/ui/rich-text-editor.reel/rich-text-editor.js b/node_modules/montage/ui/rich-text-editor.reel/rich-text-editor.js deleted file mode 100644 index 37fb9599..00000000 --- a/node_modules/montage/ui/rich-text-editor.reel/rich-text-editor.js +++ /dev/null | |||
@@ -1,1669 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | /** | ||
7 | @module "montage/ui/rich-text-editor.reel" | ||
8 | @requires montage/core/core | ||
9 | */ | ||
10 | var Montage = require("montage").Montage, | ||
11 | Component = require("ui/component").Component, | ||
12 | MutableEvent = require("core/event/mutable-event").MutableEvent, | ||
13 | Resizer = require("./rich-text-resizer").Resizer, | ||
14 | Sanitizer = require("./rich-text-sanitizer").Sanitizer, | ||
15 | Point = require("core/geometry/point").Point; | ||
16 | |||
17 | /** | ||
18 | @class module:"montage/ui/rich-text-editor.reel".RichTextEditor | ||
19 | @extends module:montage/ui/component.Component | ||
20 | */ | ||
21 | exports.RichTextEditor = Montage.create(Component,/** @lends module:"montage/ui/rich-text-editor.reel".RichTextEditor# */ { | ||
22 | |||
23 | /** | ||
24 | Description TODO | ||
25 | @private | ||
26 | */ | ||
27 | _hasSelectionChangeEvent: { | ||
28 | enumerable: false, | ||
29 | value: null // Need to be preset to null, will be set to true or false later on | ||
30 | }, | ||
31 | |||
32 | /** | ||
33 | Description TODO | ||
34 | @private | ||
35 | */ | ||
36 | _uniqueId: { | ||
37 | enumerable: false, | ||
38 | value: Math.floor(Math.random() * 1000) + "-" + Math.floor(Math.random() * 1000) | ||
39 | }, | ||
40 | |||
41 | /** | ||
42 | Description TODO | ||
43 | @private | ||
44 | */ | ||
45 | _needsSelectionReset: { | ||
46 | enumerable: false, | ||
47 | value: false | ||
48 | }, | ||
49 | |||
50 | /** | ||
51 | Description TODO | ||
52 | @private | ||
53 | */ | ||
54 | _selectionChangeTimer: { | ||
55 | enumerable: false, | ||
56 | value: null | ||
57 | }, | ||
58 | |||
59 | /** | ||
60 | Description TODO | ||
61 | @private | ||
62 | */ | ||
63 | _activeLink: { | ||
64 | enumerable: false, | ||
65 | value: null | ||
66 | }, | ||
67 | |||
68 | /** | ||
69 | Description TODO | ||
70 | @private | ||
71 | */ | ||
72 | _needsActiveLinkOn: { | ||
73 | enumerable: false, | ||
74 | value: false | ||
75 | }, | ||
76 | |||
77 | /** | ||
78 | Description TODO | ||
79 | @private | ||
80 | */ | ||
81 | _hasFocus: { | ||
82 | enumerable: false, | ||
83 | value: false | ||
84 | }, | ||
85 | |||
86 | /** | ||
87 | Description TODO | ||
88 | @type {Function} | ||
89 | */ | ||
90 | hasFocus: { | ||
91 | enumerable: true, | ||
92 | get: function() { | ||
93 | return this._hasFocus; | ||
94 | } | ||
95 | }, | ||
96 | |||
97 | /** | ||
98 | Description TODO | ||
99 | @private | ||
100 | */ | ||
101 | _dirty: { | ||
102 | enumerable: false, | ||
103 | value: false | ||
104 | }, | ||
105 | |||
106 | /** | ||
107 | Description TODO | ||
108 | @private | ||
109 | */ | ||
110 | _value: { | ||
111 | enumerable: false, | ||
112 | value: "" | ||
113 | }, | ||
114 | |||
115 | /** | ||
116 | Description TODO | ||
117 | @type {Function} | ||
118 | */ | ||
119 | value: { | ||
120 | enumerable: true, | ||
121 | serializable: true, | ||
122 | get: function() { | ||
123 | var contentNode = this.element.firstChild, | ||
124 | content; | ||
125 | |||
126 | if (this._dirtyValue) { | ||
127 | if (this._resizer) { | ||
128 | contentNode = this._resizer.cleanup(contentNode); | ||
129 | } | ||
130 | |||
131 | contentNode = this._cleanupActiveLink(contentNode); | ||
132 | |||
133 | content = contentNode ? contentNode.innerHTML : ""; | ||
134 | if (content == "<br>") { | ||
135 | // when the contentEditable div is emptied, Chrome add a <br>, let's filter it out | ||
136 | content = ""; | ||
137 | } | ||
138 | if (this._sanitizer) { | ||
139 | content = this._sanitizer.didGetValue(content, this._uniqueId); | ||
140 | } | ||
141 | |||
142 | this._value = content; | ||
143 | this._dirtyValue = false; | ||
144 | } | ||
145 | return this._value; | ||
146 | }, | ||
147 | set: function(value) { | ||
148 | if (this._value !== value || this._dirtyValue) { | ||
149 | if (this._resizer) { | ||
150 | this._needsHideResizer = true; | ||
151 | } | ||
152 | |||
153 | if (this._sanitizer) { | ||
154 | value = this._sanitizer.willSetValue(value, this._uniqueId); | ||
155 | } | ||
156 | this._value = value; | ||
157 | this._dirtyValue = false; | ||
158 | this._dirtyTextValue = true; | ||
159 | this._needsSelectionReset = true; | ||
160 | this._needsResetContent = true; | ||
161 | this.needsDraw = true; | ||
162 | } | ||
163 | } | ||
164 | }, | ||
165 | |||
166 | /** | ||
167 | Description TODO | ||
168 | @private | ||
169 | */ | ||
170 | _textValue: { | ||
171 | enumerable: false, | ||
172 | value: "" | ||
173 | }, | ||
174 | |||
175 | /** | ||
176 | Description TODO | ||
177 | @type {Function} | ||
178 | */ | ||
179 | textValue: { | ||
180 | enumerable: true, | ||
181 | get: function() { | ||
182 | var contentNode = this.element.firstChild, | ||
183 | childNodes; | ||
184 | |||
185 | if (this._dirtyTextValue) { | ||
186 | if (contentNode) { | ||
187 | if (this._resizer) { | ||
188 | contentNode = this._resizer.cleanup(contentNode); | ||
189 | } | ||
190 | contentNode = this._cleanupActiveLink(contentNode); | ||
191 | } | ||
192 | |||
193 | this._textValue = contentNode ? this._innerText(contentNode) : ""; | ||
194 | this._dirtyTextValue = false; | ||
195 | } | ||
196 | return this._textValue; | ||
197 | }, | ||
198 | set: function (value) { | ||
199 | if (this._textValue !== value || this._dirtyTextValue) { | ||
200 | if (this._resizer) { | ||
201 | this._needsHideResizer = true; | ||
202 | } | ||
203 | |||
204 | this._textValue = value; | ||
205 | this._dirtyTextValue = false; | ||
206 | this._dirtyValue = true; | ||
207 | this._needsSelectionReset = true; | ||
208 | this._needsResetContent = true; | ||
209 | this.needsDraw = true; | ||
210 | } | ||
211 | } | ||
212 | }, | ||
213 | |||
214 | /** | ||
215 | Description TODO | ||
216 | @type {} | ||
217 | * |