diff options
author | Valerio Virgillito | 2012-04-18 13:48:51 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-18 13:48:51 -0700 |
commit | 2e04af953463643791f6362bd8ef4c6ba190abfa (patch) | |
tree | d07aaf646091ddf9dad5b030a7905055fd323490 /node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor.js | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-2e04af953463643791f6362bd8ef4c6ba190abfa.tar.gz |
Squashed commit of the following:
commit 2054551bfb01a0f4ca2e138b9d724835462d45cd
Merge: 765c2da 616a853
Author: Valerio Virgillito <valerio@motorola.com>
Date: Wed Apr 18 13:48:21 2012 -0700
Merge branch 'refs/heads/master' into integration
commit 765c2da8e1aa03550caf42b2bd5f367555ad2843
Author: Valerio Virgillito <valerio@motorola.com>
Date: Tue Apr 17 15:29:41 2012 -0700
updating the picasa carousel
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
commit 9484f1c82b81e27edf2dc0a1bcc1fa3b12077406
Merge: d27f2df cacb4a2
Author: Valerio Virgillito <valerio@motorola.com>
Date: Tue Apr 17 15:03:50 2012 -0700
Merge branch 'refs/heads/master' into integration
commit d27f2df4d846064444263d7832d213535962abe7
Author: Valerio Virgillito <valerio@motorola.com>
Date: Wed Apr 11 10:39:36 2012 -0700
integrating new picasa carousel component
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
commit 6f98384c9ecbc8abe55ccfe1fc25a0c7ce22c493
Author: Valerio Virgillito <valerio@motorola.com>
Date: Tue Apr 10 14:33:00 2012 -0700
fixed the text area case issue
Text area was renamed from TextArea to Textarea
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
commit 1e83e26652266136802bc7af930379c1ecd631a6
Author: Valerio Virgillito <valerio@motorola.com>
Date: Mon Apr 9 22:10:45 2012 -0700
integrating montage v0.8 into ninja.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor.js')
-rw-r--r-- | node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor.js | 614 |
1 files changed, 614 insertions, 0 deletions
diff --git a/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor.js b/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor.js new file mode 100644 index 00000000..89af8eb3 --- /dev/null +++ b/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor.js | |||
@@ -0,0 +1,614 @@ | |||
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 | RichTextEditorBase = require("./rich-text-editor-base").RichTextEditorBase, | ||
12 | Sanitizer = require("./rich-text-sanitizer").Sanitizer, | ||
13 | MutableEvent = require("core/event/mutable-event").MutableEvent, | ||
14 | defaultEventManager = require("core/event/event-manager").defaultEventManager; | ||
15 | |||
16 | /** | ||
17 | @class module:"montage/ui/rich-text-editor.reel".RichTextEditor | ||
18 | @extends module:montage/ui/component.Component | ||
19 | */ | ||
20 | exports.RichTextEditor = Montage.create(RichTextEditorBase,/** @lends module:"montage/ui/rich-text-editor.reel".RichTextEditor# */ { | ||
21 | |||
22 | /** | ||
23 | Description TODO | ||
24 | @type {Function} | ||
25 | */ | ||
26 | hasFocus: { | ||
27 | enumerable: true, | ||
28 | get: function() { | ||
29 | return this._hasFocus; | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | /** | ||
34 | Description TODO | ||
35 | @type {Function} | ||
36 | */ | ||
37 | innerElement: { | ||
38 | enumerable: true, | ||
39 | get: function() { | ||
40 | return this._innerElement; | ||
41 | } | ||
42 | }, | ||
43 | |||
44 | |||
45 | /** | ||
46 | Description TODO | ||
47 | @type {Function} | ||
48 | */ | ||
49 | focus: { | ||
50 | enumerable: true, | ||
51 | value: function() { | ||
52 | this._needsFocus = true; | ||
53 | this.needsDraw = true; | ||
54 | } | ||
55 | }, | ||
56 | |||
57 | /** | ||
58 | Description TODO | ||
59 | @type {Function} | ||
60 | */ | ||
61 | isActiveElement: { | ||
62 | enumerable: true, | ||
63 | get: function() { | ||
64 | return this._isActiveElement; | ||
65 | } | ||
66 | }, | ||
67 | |||
68 | /** | ||
69 | Description TODO | ||
70 | @type {Function} | ||
71 | */ | ||
72 | readOnly: { | ||
73 | enumerable: true, | ||
74 | get: function() { | ||
75 | return this._readOnly; | ||
76 | }, | ||
77 | set: function(value) { | ||
78 | if (this._readOnly !== value) { | ||
79 | this._readOnly = value; | ||
80 | if (value) { | ||
81 | // Remove any overlay | ||
82 | this.hideOverlay(); | ||
83 | } | ||
84 | this.needsDraw = true; | ||
85 | } | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | /** | ||
90 | Description TODO | ||
91 | @type {Function} | ||
92 | */ | ||
93 | value: { | ||
94 | enumerable: true, | ||
95 | serializable: true, | ||
96 | get: function() { | ||
97 | var contentNode = this._innerElement, | ||
98 | content = "", | ||
99 | overlayElement = null, | ||
100 | overlayParent, | ||
101 | overlayNextSibling; | ||
102 | |||
103 | if (this._dirtyValue) { | ||
104 | if (contentNode) { | ||
105 | // Temporary orphran the overlay slot while retrieving the content | ||
106 | overlayElement = contentNode.querySelector(".montage-editor-overlay"); | ||
107 | if (overlayElement) { | ||
108 | overlayParent = overlayElement.parentNode; | ||
109 | overlayNextSibling = overlayElement.nextSibling; | ||
110 | overlayParent.removeChild(overlayElement); | ||
111 | } | ||
112 | content = contentNode.innerHTML; | ||
113 | } | ||
114 | |||
115 | if (content == "<br>") { | ||
116 | // when the contentEditable div is emptied, Chrome add a <br>, let's filter it out | ||
117 | content = ""; | ||
118 | } | ||
119 | if (this._sanitizer === undefined) { | ||
120 | this._sanitizer = Sanitizer.create(); | ||
121 | } | ||
122 | if (this._sanitizer) { | ||
123 | content = this._sanitizer.didGetValue(content, this._uniqueId); | ||
124 | } | ||
125 | |||
126 | // restore the overlay | ||
127 | if (overlayElement) { | ||
128 | overlayParent.insertBefore(overlayElement, overlayNextSibling); | ||
129 | } | ||
130 | |||
131 | this._value = content; | ||
132 | this._dirtyValue = false; | ||
133 | } | ||
134 | return this._value; | ||
135 | }, | ||
136 | set: function(value) { | ||
137 | if (this._value !== value || this._dirtyValue) { | ||
138 | // Remove any overlay | ||
139 | this.hideOverlay(); | ||
140 | |||
141 | if (this._sanitizer === undefined) { | ||
142 | this._sanitizer = Sanitizer.create(); | ||
143 | } | ||
144 | if (this._sanitizer) { | ||
145 | value = this._sanitizer.willSetValue(value, this._uniqueId); | ||
146 | } | ||
147 | this._value = value; | ||
148 | this._dirtyValue = false; | ||
149 | this._dirtyTextValue = true; | ||
150 | this._needsAssingValue = true; | ||
151 | this.needsDraw = true; | ||
152 | } | ||
153 | this._needsOriginalContent = false; | ||
154 | } | ||
155 | }, | ||
156 | |||
157 | /** | ||
158 | Description TODO | ||
159 | @type {Function} | ||
160 | */ | ||
161 | textValue: { | ||
162 | enumerable: true, | ||
163 | get: function() { | ||
164 | var contentNode = this._innerElement, | ||
165 | overlayElement = null, | ||
166 | overlayParent, | ||
167 | overlayNextSibling; | ||
168 | |||
169 | if (this._dirtyTextValue) { | ||
170 | if (contentNode) { | ||
171 | // Temporary orphran the overlay slot in order to retrieve the content | ||
172 | overlayElement = contentNode.querySelector(".montage-editor-overlay"); | ||
173 | if (overlayElement) { | ||
174 | overlayParent = overlayElement.parentNode; | ||
175 | overlayNextSibling = overlayElement.nextSibling; | ||
176 | overlayParent.removeChild(overlayElement); | ||
177 | } | ||
178 | |||
179 | this._textValue = this._innerText(contentNode); | ||
180 | |||
181 | // restore the overlay | ||
182 | if (overlayElement) { | ||
183 | overlayParent.insertBefore(overlayElement, overlayNextSibling); | ||
184 | } | ||
185 | } else { | ||
186 |