diff options
Diffstat (limited to 'node_modules/montage/ui/rich-text-editor')
7 files changed, 226 insertions, 165 deletions
diff --git a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.html b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.html index 9595d7ab..9bb4b0df 100644 --- a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.html +++ b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-linkpopup.reel/rich-text-linkpopup.html | |||
@@ -6,25 +6,25 @@ | |||
6 | </copyright> --> | 6 | </copyright> --> |
7 | <html> | 7 | <html> |
8 | <head> | 8 | <head> |
9 | <title></title> | 9 | <meta charset="utf-8"> |
10 | <link rel="stylesheet" type="text/css" href="rich-text-linkpopup.css"> | 10 | <link rel="stylesheet" href="rich-text-linkpopup.css"> |
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | "link": { | 13 | "link": { |
14 | "prototype": "ui/anchor.reel", | 14 | "prototype": "ui/anchor.reel", |
15 | "properties": { | 15 | "properties": { |
16 | "element": {"#": "link"} | 16 | "element": {"#": "link"} |
17 | } | 17 | } |
18 | }, | 18 | }, |
19 | 19 | ||
20 | "owner": { | 20 | "owner": { |
21 | "prototype": "ui/rich-text-editor/overlays/rich-text-linkpopup.reel[RichTextLinkPopup]", | 21 | "prototype": "ui/rich-text-editor/overlays/rich-text-linkpopup.reel[RichTextLinkPopup]", |
22 | "properties": { | 22 | "properties": { |
23 | "element": {"#": "linkpopup-container"}, | 23 | "element": {"#": "linkpopup-container"}, |
24 | "link": {"@": "link"} | 24 | "link": {"@": "link"} |
25 | } | ||
26 | } | ||
27 | } | 25 | } |
26 | } | ||
27 | } | ||
28 | </script> | 28 | </script> |
29 | </head> | 29 | </head> |
30 | <body> | 30 | <body> |
@@ -32,4 +32,4 @@ | |||
32 | <a data-montage-id="link" target="_blank"></a> | 32 | <a data-montage-id="link" target="_blank"></a> |
33 | </div> | 33 | </div> |
34 | </body> | 34 | </body> |
35 | </html> | 35 | </html> \ No newline at end of file |
diff --git a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.html b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.html index 526d6563..d7dbe11c 100644 --- a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.html +++ b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.html | |||
@@ -6,25 +6,25 @@ | |||
6 | </copyright> --> | 6 | </copyright> --> |
7 | <html> | 7 | <html> |
8 | <head> | 8 | <head> |
9 | <title></title> | 9 | <meta charset="utf-8"> |
10 | <link rel="stylesheet" type="text/css" href="rich-text-resizer.css"> | 10 | <link rel="stylesheet" href="rich-text-resizer.css"> |
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | "image": { | 13 | "image": { |
14 | "prototype": "ui/image.reel", | 14 | "prototype": "ui/image.reel", |
15 | "properties": { | 15 | "properties": { |
16 | "element": {"#": "image"} | 16 | "element": {"#": "image"} |
17 | } | 17 | } |
18 | }, | 18 | }, |
19 | 19 | ||
20 | "owner": { | 20 | "owner": { |
21 | "prototype": "ui/rich-text-editor/overlays/rich-text-resizer.reel", | 21 | "prototype": "ui/rich-text-editor/overlays/rich-text-resizer.reel", |
22 | "properties": { | 22 | "properties": { |
23 | "element": {"#": "resizer-container"}, | 23 | "element": {"#": "resizer-container"}, |
24 | "image": {"@": "image"} | 24 | "image": {"@": "image"} |
25 | } | ||
26 | } | ||
27 | } | 25 | } |
26 | } | ||
27 | } | ||
28 | </script> | 28 | </script> |
29 | </head> | 29 | </head> |
30 | <body> | 30 | <body> |
diff --git a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.js b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.js index c9f94565..2b0fa5c0 100644 --- a/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.js +++ b/node_modules/montage/ui/rich-text-editor/overlays/rich-text-resizer.reel/rich-text-resizer.js | |||
@@ -231,7 +231,7 @@ exports.RichTextResizer = Montage.create(Component,/** @lends module:"montage/ui | |||
231 | var zero = Point.create().init(0, 0), | 231 | var zero = Point.create().init(0, 0), |
232 | framePosition = dom.convertPointFromNodeToPage(element, zero), | 232 | framePosition = dom.convertPointFromNodeToPage(element, zero), |
233 | cursor = this._cursorPosition, | 233 | cursor = this._cursorPosition, |
234 | direction = this._draggedElement.id.substring("montage-resizer-handle-".length), | 234 | direction = this._draggedElement.getAttribute("data-montage-id").substring("montage-resizer-handle-".length), |
235 | info = this._resizerFrameInfo, | 235 | info = this._resizerFrameInfo, |
236 | ratio = info.ratio, | 236 | ratio = info.ratio, |
237 | height = parseFloat(element.style.height, 10), | 237 | height = parseFloat(element.style.height, 10), |
diff --git a/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js b/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js index 0bdf67e7..9791908f 100644 --- a/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js +++ b/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js | |||
@@ -9,13 +9,31 @@ | |||
9 | */ | 9 | */ |
10 | var Montage = require("montage").Montage, | 10 | var Montage = require("montage").Montage, |
11 | Component = require("ui/component").Component, | 11 | Component = require("ui/component").Component, |
12 | MutableEvent = require("core/event/mutable-event").MutableEvent, | ||
13 | Sanitizer = require("./rich-text-sanitizer").Sanitizer, | 12 | Sanitizer = require("./rich-text-sanitizer").Sanitizer, |
14 | RichTextLinkPopup = require("../overlays/rich-text-linkpopup.reel").RichTextLinkPopup, | 13 | RichTextLinkPopup = require("../overlays/rich-text-linkpopup.reel").RichTextLinkPopup, |
15 | RichTextResizer = require("../overlays/rich-text-resizer.reel").RichTextResizer, | 14 | RichTextResizer = require("../overlays/rich-text-resizer.reel").RichTextResizer, |
16 | defaultEventManager = require("core/event/event-manager").defaultEventManager, | 15 | ChangeNotification = require("core/change-notification").ChangeNotification, |
17 | defaultUndoManager = require("core/undo-manager").defaultUndoManager; | 16 | defaultUndoManager = require("core/undo-manager").defaultUndoManager; |
18 | 17 | ||
18 | |||
19 | /** static variables, constants | ||
20 | */ | ||
21 | var COMMANDS = [ | ||
22 | {property: "bold"}, | ||
23 | {property: "underline"}, | ||
24 | {property: "italic"}, | ||
25 | {property: "strikeThrough"}, | ||
26 | {property: "baselineShift", method: this._baselineShiftGetState}, | ||
27 | {property: "justify", method: this._justifyGetState}, | ||
28 | {property: "listStyle", method: this._listStyleGetState}, | ||
29 | {property: "fontName", method: this._fontNameGetState}, | ||
30 | {property: "fontSize"}, | ||
31 | {property: "backColor"}, | ||
32 | {property: "foreColor"} | ||
33 | ], | ||
34 | NBR_COMMANDS = COMMANDS.length; | ||
35 | |||
36 | |||
19 | /** | 37 | /** |
20 | @class module:"montage/ui/rich-text-editor.reel".RichTextEditorBase | 38 | @class module:"montage/ui/rich-text-editor.reel".RichTextEditorBase |
21 | @extends module:montage/ui/component.Component | 39 | @extends module:montage/ui/component.Component |
@@ -254,9 +272,17 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
254 | // Commands Helpers | 272 | // Commands Helpers |
255 | _getState: { | 273 | _getState: { |
256 | value: function(property, command) { | 274 | value: function(property, command) { |
257 | var state; | 275 | var state, |
276 | savedActiveElement = document.activeElement, | ||
277 | editorElement = this._innerElement; | ||
278 | |||
279 | if (editorElement && !this["_" + property + "_locked"]) { | ||
280 | |||
281 | // Make sure we are the active element before calling execCommand | ||
282 | if (editorElement && editorElement != savedActiveElement) { | ||
283 | editorElement.focus(); | ||
284 | } | ||
258 | 285 | ||
259 | if (this._innerElement == document.activeElement) { | ||
260 | state = document.queryCommandValue(command); | 286 | state = document.queryCommandValue(command); |
261 | // Convert string to boolean |