aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-04-18 13:48:51 -0700
committerValerio Virgillito2012-04-18 13:48:51 -0700
commit2e04af953463643791f6362bd8ef4c6ba190abfa (patch)
treed07aaf646091ddf9dad5b030a7905055fd323490 /node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js
parent616a8532099fec2a15855eac97cd85cb60c4451c (diff)
downloadninja-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/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js')
-rw-r--r--node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js274
1 files changed, 274 insertions, 0 deletions
diff --git a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js
new file mode 100644
index 00000000..90342d81
--- /dev/null
+++ b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.js
@@ -0,0 +1,274 @@
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/overlays/rich-text-resizer.reel"
8 @requires montage/core/core
9 @requires montage/ui/component
10*/
11var Montage = require("montage").Montage,
12 Component = require("ui/component").Component;
13
14/**
15 @class module:"montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel".RichTextLinkPopup
16 @extends module:montage/ui/component.Component
17*/
18exports.RichTextLinkPopup = Montage.create(Component,/** @lends module:"montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel".RichTextLinkPopup# */ {
19
20 /**
21 Description TODO
22 @private
23 */
24 _isActive: {
25 enumerable: false,
26 value: false
27 },
28 /**
29 Description TODO
30 @private
31 */
32 _editor: {
33 enumerable: false,
34 value: null
35 },
36
37 /**
38 Description TODO
39 @private
40 */
41 target: {
42 enumerable: false,
43 value: null
44 },
45
46 /**
47 Description TODO
48 @private
49 */
50 _needsReset: {
51 enumerable: false,
52 value: false
53 },
54
55 /**
56 Description TODO
57 @type {Function}
58 */
59 initWithEditor: {
60 value: function(editor) {
61 this._editor = editor;
62 }
63 },
64
65 /**
66 Description TODO
67 @type {Function}
68 */
69 editorMouseUp: {
70 value: function(event) {
71 var element;
72
73 if (this._editor.activeOverlay != this) {
74 // Check if the caret is inside an image within an anchor element
75 if (event.target.nodeName == "IMG") {
76 element = event.target;
77 while (element && element != this._element) {
78 if (element.nodeName == "A") {
79 if (element != this.target) {
80 this.target = element;
81 this._needsReset = true;
82 if (this._isActive) {
83 this.needsDraw = true;
84 } else {
85 this._editor.showOverlay(this);
86 }
87 }
88 return true;
89 }
90 element = element.parentElement;
91 }
92 }
93 }
94 }
95 },
96
97 /**
98 Description TODO
99 @type {Function}
100 */
101 editorTouchEnd: {
102 value: function(event) {
103 this.editorMouseUp(event);
104 }
105 },
106
107 /**
108 Description TODO
109 @type {Function}
110 */
111 editorSelectionDidChange: {
112 value: function(range) {
113 var element;
114
115 // Check if the caret is inside an anchor element
116 if (range && range.collapsed) {
117 element = range.commonAncestorContainer;
118 while (element && element != this._element) {
119 if (element.nodeName == "A") {
120 if (element != this.target) {
121 this.target = element;
122 this._needsReset = true;
123 if (this._isActive) {
124 this.needsDraw = true;
125 } else {
126 this._editor.showOverlay(this);
127 }
128 }
129 return true;
130 }
131 element = element.parentElement;
132 }
133 }
134
135 if (this._editor.activeOverlay == this) {
136 this._editor.hideOverlay();
137 }
138
139 return false;
140 }
141 },
142
143 /**
144 Description TODO
145 @function
146 */
147 didBecomeActive: {
148 value: function() {
149 this._isActive = true;
150 window.addEventListener("resize", this, false);
151 }
152 },
153
154 /**
155 Description TODO
156 @function
157 */
158 didBecomeInactive: {
159 value: function() {
160 this._isActive = false;
161 window.removeEventListener("resize", this, false);
162
163 //Reset the resizer internal
164 this.target = null;
165 this._needsReset = false;
166 }
167 },
168
169 /**
170 Description TODO
171 @function
172 */
173 prepareForDraw: {
174 enumerable: false,
175 value: function() {
176 this._popupExtraWidth = this.element.offsetWidth;
177 }
178 },
179