From 7f8730c3add146f1ba107e6fc22d1f5a8348ed8b Mon Sep 17 00:00:00 2001
From: Armen Kesablyan
Date: Tue, 7 Feb 2012 16:43:22 -0800
Subject: Refactored rich text editor location
---
.../rich-text-editor.reel/rich-text-sanitizer.js | 132 +++++++++++++++++++++
1 file changed, 132 insertions(+)
create mode 100644 node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js
(limited to 'node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js')
diff --git a/node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js b/node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js
new file mode 100644
index 00000000..3282d3e6
--- /dev/null
+++ b/node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js
@@ -0,0 +1,132 @@
+/*
+ This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
+/**
+ @module "montage/ui/rich-text-sanitizer.js"
+ @requires montage/core/core
+*/
+var Montage = require("montage").Montage;
+
+/**
+ @class module:"montage/ui/rich-text-sanitizer.js".Sanitizer
+ @extends module:montage/core/core.Montage
+*/
+exports.Sanitizer = Montage.create(Montage,/** @lends module:"montage/ui/rich-text-sanitizer.js".Sanitizer# */ {
+
+ willSetValue: {
+ value: function(value, identifier) {
+ return this._scopeCSS(value, identifier);
+ }
+ },
+
+ didGetValue: {
+ value: function(value, identifier) {
+ return this._unscopeCSS(value, identifier);
+ }
+ },
+
+ willInsertHTMLData: {
+ value: function(data, identifier) {
+ return this._scopeCSS(this._removeScript(data), identifier);
+ }
+ },
+
+ _scopeCSS: {
+ enumerable: true,
+ value: function(htmlFragment, identifier) {
+ var identifierSelector = ".editor-" + identifier+ " ";
+
+ if (typeof htmlFragment == "string") {
+ // Extract the style tag and its content
+ htmlFragment = htmlFragment.replace(/(