⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sync.richtextarea.js

📁 echo3 很炫的ajax框架技术 js 演示demo ajax j2ee 里面有jsp演示代码
💻 JS
📖 第 1 页 / 共 5 页
字号:
/** * Component rendering peer: RichTextArea */Extras.Sync.RichTextArea = Core.extend(Echo.Arc.ComponentSync, {        $static: {        DEFAULT_CONTROL_PANE_SPLIT_PANE_STYLE: {            orientation: Echo.SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP,            separatorColor: "#dfdfef",            separatorHeight: 1,            autoPositioned: true        },                DEFAULT_CONTROL_PANE_ROW_STYLE: {            insets: "2px 10px",            cellSpacing: 3,            layoutData: {                overflow: Echo.SplitPane.OVERFLOW_HIDDEN,                background: "#cfcfdf"            }        },                DEFAULT_CONTROL_PANE_BUTTON_STYLE: {            insets: "0px 8px",            lineWrap: false,            foreground: "#000000",            rolloverEnabled: true,            rolloverForeground: "#6f0f0f"        },                /**         * Default enabled feature set.         */        defaultFeatures: {            menu: true, toolbar: true, undo: true, clipboard: true, alignment: true, foreground: true, background: true,            list: true, table: true, image: true, horizontalRule: true, hyperlink: true, subscript: true,             bold: true, italic: true, underline: true, strikethrough: true, paragraphStyle: true, indent: true        },        /**         * Default localization strings.         */        resource: new Core.ResourceBundle({            "ColorDialog.Title.Foreground":     "Text Color",            "ColorDialog.Title.Background":     "Highlight Color",            "ColorDialog.PromptForeground":     "Foreground:",            "ColorDialog.PromptBackground":     "Background:",            "Error.ClipboardAccessDisabled":    "This browser has clipboard access disabled. " +                                                 "Use keyboard shortcuts or change your security settings.",            "Generic.Cancel":                   "Cancel",            "Generic.Error":                    "Error",            "Generic.Ok":                       "Ok",            "HyperlinkDialog.Title":            "Insert Hyperlink",            "HyperlinkDialog.PromptURL":        "URL:",            "HyperlinkDialog.PromptDescription":                                                "Description Text:",            "HyperlinkDialog.ErrorDialogTitle": "Cannot Insert Hyperlink",            "HyperlinkDialog.ErrorDialog.URL":  "The URL entered is not valid.",            "ImageDialog.Title":                "Insert Image",            "ImageDialog.PromptURL":            "URL:",            "ImageDialog.ErrorDialogTitle":     "Cannot Insert Image",            "ImageDialog.ErrorDialog.URL":      "The URL entered is not valid.",            "Menu.Edit":                        "Edit",            "Menu.Undo":                        "Undo",            "Menu.Redo":                        "Redo",            "Menu.Cut":                         "Cut",            "Menu.Copy":                        "Copy",            "Menu.Paste":                       "Paste",            "Menu.Delete":                      "Delete",            "Menu.SelectAll":                   "Select All",            "Menu.Insert":                      "Insert",            "Menu.InsertImage":                 "Image...",            "Menu.InsertHyperlink":             "Hyperlink...",            "Menu.InsertHorizontalRule":        "Horizontal Rule",            "Menu.InsertTable":                 "Table...",            "Menu.BulletedList":                "Bulleted List",            "Menu.NumberedList":                "Numbered List",            "Menu.Format":                      "Format",            "Menu.Bold":                        "Bold",            "Menu.Italic":                      "Italic",            "Menu.Underline":                   "Underline",            "Menu.Strikethrough":               "Strikethrough",            "Menu.Superscript":                 "Superscript",            "Menu.Subscript":                   "Subscript",            "Menu.PlainText":                   "Plain Text",            "Menu.TextStyle":                   "Text Style",            "Menu.ParagraphStyle":              "Paragraph Style",            "Menu.Alignment":                   "Alignment",            "Menu.Left":                        "Left",            "Menu.Right":                       "Right",            "Menu.Center":                      "Center",            "Menu.Justified":                   "Justified",            "Menu.Indent":                      "Indent",            "Menu.Outdent":                     "Outdent",            "Menu.SetForeground":               "Set Text Color...",            "Menu.SetBackground":               "Set Highlight Color...",            "Menu.Heading1":                    "Heading 1",            "Menu.Heading2":                    "Heading 2",            "Menu.Heading3":                    "Heading 3",            "Menu.Heading4":                    "Heading 4",            "Menu.Heading5":                    "Heading 5",            "Menu.Heading6":                    "Heading 6",            "Menu.Normal":                      "Normal",            "Menu.Preformatted":                "Preformatted",            "TableDialog.Title":                "Insert Table",            "TableDialog.PromptRows":           "Rows:",            "TableDialog.PromptColumns":        "Columns:",            "TableDialog.ErrorDialogTitle":     "Cannot Insert Table",            "TableDialog.ErrorDialog.Columns":  "The entered columns value is not valid.  " +                                                "Please specify a number between 1 and 50.",            "TableDialog.ErrorDialog.Rows":     "The entered rows value is not valid.  Please specify a number between 1 and 50."        })    },        _processDialogCloseRef: null,    _processComponentInsertHtmlRef: null,    $load: function() {        Echo.Render.registerPeer("Extras.RichTextArea", this);    },    $virtual: {            /**         * Creates/returns the icon set for this RichTextArea.         */        getIcons: function() {            var icons = this._getDefaultIcons();            var customIcons = this.component.get("icons");            if (customIcons) {                for (var x in customIcons) {                    icons[x] = customIcons[x];                }            }            return icons;        },                /**         * Event handler for user request (from menu/toolbar) to insert a hyperlink.         */        processInsertHyperlink: function(e) {            var hyperlinkDialog = new Extras.Sync.RichTextArea.HyperlinkDialog(this.component);            hyperlinkDialog.addListener("insertHyperlink", Core.method(this, function(e) {                this._richTextInput.peer._insertHtml("<a href=\"" + e.data.url + "\">" +                        (e.data.description ? e.data.description : e.data.url) + "</a>");                this.focusDocument();            }));            this._openDialog(hyperlinkDialog);        },                /**         * Event handler for user request (from menu/toolbar) to insert an image.         */        processInsertImage: function(e) {            var imageDialog = new Extras.Sync.RichTextArea.ImageDialog(this.component);            imageDialog.addListener("insertImage", Core.method(this, function(e) {                this._richTextInput.peer._insertHtml("<img src=\"" + e.data.url + "\">");                this.focusDocument();            }));            this._openDialog(imageDialog);        },        /**         * Event handler for user request (from menu/toolbar) to insert a table.         */        processInsertTable: function(e) {            var tableDialog = new Extras.Sync.RichTextArea.TableDialog(this.component);            tableDialog.addListener("tableInsert", Core.method(this, function(e) {                this.insertTable(e.data.columns, e.data.rows);                this.focusDocument();            }));            this._openDialog(tableDialog);        },        /**         * Event handler for user request (from menu/toolbar) to set the background color.         */        processSetBackground: function(e) {            var colorDialog = new Extras.Sync.RichTextArea.ColorDialog(this.component, true,                    this._toolbarButtons.background.get("color"));            colorDialog.addListener("colorSelect", Core.method(this, function(e) {                if (Core.Web.Env.BROWSER_INTERNET_EXPLORER) {                    Core.Web.Scheduler.run(Core.method(this, function() {                        this.execCommand("backcolor", e.data);                    }));                } else {                    this.execCommand("hilitecolor", e.data);                }                this._toolbarButtons.background.set("color", e.data);                this.focusDocument();            }));            this._openDialog(colorDialog);        },                /**         * Event handler for user request (from menu/toolbar) to set the foreground color.         */        processSetForeground: function(e) {            var colorDialog = new Extras.Sync.RichTextArea.ColorDialog(this.component, false,                    this._toolbarButtons.foreground.get("color"));            colorDialog.addListener("colorSelect", Core.method(this, function(e) {                this.execCommand("forecolor", e.data);                this._toolbarButtons.foreground.set("color", e.data);                this.focusDocument();            }));            this._openDialog(colorDialog);        }    },        /**     * Localized messages for rendered locale.     */    _msg: null,        /**     * {Boolean} Flag indicating whether the parent component is a pane, and thus whether the RichTextArea should consume     * horizontal and vertical space.     */    _paneRender: false,        _toolbarButtons: null,        _styleSelect: null,        $construct: function() {        this._processComponentInsertHtmlRef = Core.method(this, this._processComponentInsertHtml);        this._processDialogCloseRef = Core.method(this, this._processDialogClose);        this._toolbarButtons = { };    },        _addComponentListeners: function() {        this.component.addListener("insertHtml", this._processComponentInsertHtmlRef);    },    createComponent: function() {        var features = this.component.render("features", Extras.Sync.RichTextArea.defaultFeatures);        var contentPane = new Echo.ContentPane();        var cursor = contentPane;        if (features.menu) {            var menuSplitPane = new Echo.SplitPane({                orientation: Echo.SplitPane.ORIENTATION_VERTICAL_TOP_BOTTOM,                autoPositioned: true,                children: [                    this._createMenu()                ]            });            cursor.add(menuSplitPane);            cursor = menuSplitPane;        }                if (features.toolbar) {            var toolbarContainer = new Echo.SplitPane({                orientation: Echo.SplitPane.ORIENTATION_VERTICAL_TOP_BOTTOM,                autoPositioned: true,                children: [                    this._createToolbar()                ]            });            cursor.add(toolbarContainer);            cursor = toolbarContainer;        }                this._richTextInput = new Extras.Sync.RichTextArea.InputComponent({            layoutData: {                overflow: Echo.SplitPane.OVERFLOW_HIDDEN            }        });        this._richTextInput._richTextArea = this.component;        cursor.add(this._richTextInput);                return contentPane;    },        /**     * Creates the model for the menu bar based on enable feature set.     *     * @return the menu model     * @type Extras.MenuModel     */    _createMainMenuBarModel: function() {        var features = this.component.render("features", Extras.Sync.RichTextArea.defaultFeatures);        var menu = new Extras.MenuModel(null, null, null);                if (features.undo || features.clipboard) {            var editMenu = new Extras.MenuModel(null, this._msg["Menu.Edit"], null);            if (features.undo) {                editMenu.addItem(new Extras.OptionModel("/undo", this._msg["Menu.Undo"], this._icons.undo));                editMenu.addItem(new Extras.OptionModel("/redo", this._msg["Menu.Redo"], this._icons.redo));            }            if (features.undo && features.clipboard) {                editMenu.addItem(new Extras.SeparatorModel());            }            if (features.clipboard) {                editMenu.addItem(new Extras.OptionModel("cut", this._msg["Menu.Cut"], this._icons.cut));                editMenu.addItem(new Extras.OptionModel("copy", this._msg["Menu.Copy"], this._icons.copy));                editMenu.addItem(new Extras.OptionModel("paste", this._msg["Menu.Paste"], this._icons.paste));                editMenu.addItem(new Extras.OptionModel("delete", this._msg["Menu.Delete"], this._icons["delete"]));                editMenu.addItem(new Extras.SeparatorModel());                editMenu.addItem(new Extras.OptionModel("/selectall", this._msg["Menu.SelectAll"], this._icons.selectAll));            }            menu.addItem(editMenu);        }                if (features.list || features.horizontalRule || features.image || features.hyperlink || features.table) {            var insertMenu = new Extras.MenuModel(null, this._msg["Menu.Insert"], null);            if (features.list) {                insertMenu.addItem(new Extras.OptionModel("/insertunorderedlist", this._msg["Menu.BulletedList"],                        this._icons.bulletedList));                insertMenu.addItem(new Extras.OptionModel("/insertorderedlist", this._msg["Menu.NumberedList"],                        this._icons.numberedList));            }            insertMenu.addItem(new Extras.SeparatorModel());            if (features.horizontalRule) {                insertMenu.addItem(new Extras.OptionModel("/inserthorizontalrule", this._msg["Menu.InsertHorizontalRule"],                        this._icons.horizontalRule));            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -