Changeset 523
- Timestamp:
- 08/15/08 00:05:33 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wymeditor/jquery.wymeditor.js
r517 r523 48 48 IFRAME_DEFAULT - The iframe's default base path. 49 49 JQUERY_PATH - A string replaced by the computed jQuery path. 50 LOGO - A string replaced by WYMeditor logo. 50 51 TOOLS - A string replaced by the toolbar's HTML. 51 52 TOOLS_ITEMS - A string replaced by the toolbar items. … … 118 119 IFRAME_DEFAULT : "iframe/default/", 119 120 JQUERY_PATH : "{Wym_Jquery_Path}", 121 LOGO : "{Wym_Logo}", 120 122 TOOLS : "{Wym_Tools}", 121 123 TOOLS_ITEMS : "{Wym_Tools_Items}", … … 341 343 + "</div>" 342 344 + "<div class='wym_area_bottom'>" 343 + "<a class='wym_wymeditor_link' " 344 + "href='http://www.wymeditor.org/'>WYMeditor</a>" 345 + WYMeditor.LOGO 345 346 + "</div>" 346 347 + "</div>", 348 349 logoHtml: "<a class='wym_wymeditor_link' " 350 + "href='http://www.wymeditor.org/'>WYMeditor</a>", 347 351 348 352 iframeHtml:"<div class='wym_iframe wym_section'>" … … 719 723 this._box = jQuery(this._element).hide().after(this._options.boxHtml).next(); 720 724 725 var h = WYMeditor.Helper; 726 721 727 //construct the iframe 722 728 var iframeHtml = this._options.iframeHtml; 723 iframeHtml = iframeHtml 724 .replaceAll(WYMeditor.INDEX,this._index) 725 .replaceAll(WYMeditor.IFRAME_BASE_PATH, this._options.iframeBasePath); 729 iframeHtml = h.replaceAll(iframeHtml, WYMeditor.INDEX, this._index); 730 iframeHtml = h.replaceAll(iframeHtml, WYMeditor.IFRAME_BASE_PATH, this._options.iframeBasePath); 726 731 727 732 //construct wymbox 728 733 var boxHtml = jQuery(this._box).html(); 729 734 730 boxHtml = boxHtml.replaceAll(WYMeditor.TOOLS, this._options.toolsHtml); 731 boxHtml = boxHtml.replaceAll(WYMeditor.CONTAINERS,this._options.containersHtml); 732 boxHtml = boxHtml.replaceAll(WYMeditor.CLASSES, this._options.classesHtml); 733 boxHtml = boxHtml.replaceAll(WYMeditor.HTML, this._options.htmlHtml); 734 boxHtml = boxHtml.replaceAll(WYMeditor.IFRAME, iframeHtml); 735 boxHtml = boxHtml.replaceAll(WYMeditor.STATUS, this._options.statusHtml); 735 boxHtml = h.replaceAll(boxHtml, WYMeditor.LOGO, this._options.logoHtml); 736 boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS, this._options.toolsHtml); 737 boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS,this._options.containersHtml); 738 boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES, this._options.classesHtml); 739 boxHtml = h.replaceAll(boxHtml, WYMeditor.HTML, this._options.htmlHtml); 740 boxHtml = h.replaceAll(boxHtml, WYMeditor.IFRAME, iframeHtml); 741 boxHtml = h.replaceAll(boxHtml, WYMeditor.STATUS, this._options.statusHtml); 736 742 737 743 //construct tools list … … 742 748 var oTool = aTools[i]; 743 749 if(oTool.name && oTool.title) 744 sTools += this._options.toolsItemHtml 745 .replaceAll(WYMeditor.TOOL_NAME, oTool.name) 746 .replaceAll(WYMeditor.TOOL_TITLE, 747 this._options.stringDelimiterLeft 750 var sTool = this._options.toolsItemHtml; 751 var sTool = h.replaceAll(sTool, WYMeditor.TOOL_NAME, oTool.name); 752 sTool = h.replaceAll(sTool, WYMeditor.TOOL_TITLE, this._options.stringDelimiterLeft 748 753 + oTool.title 749 + this._options.stringDelimiterRight) 750 .replaceAll(WYMeditor.TOOL_CLASS, oTool.css); 754 + this._options.stringDelimiterRight); 755 sTool = h.replaceAll(sTool, WYMeditor.TOOL_CLASS, oTool.css); 756 sTools += sTool; 751 757 } 752 758 753 boxHtml = boxHtml.replaceAll(WYMeditor.TOOLS_ITEMS, sTools);759 boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS_ITEMS, sTools); 754 760 755 761 //construct classes list … … 760 766 var oClass = aClasses[i]; 761 767 if(oClass.name && oClass.title) 762 sClasses += this._options.classesItemHtml 763 .replaceAll(WYMeditor.CLASS_NAME, oClass.name) 764 .replaceAll(WYMeditor.CLASS_TITLE, oClass.title); 768 var sClass = this._options.classesItemHtml; 769 sClass = h.replaceAll(sClass, WYMeditor.CLASS_NAME, oClass.name); 770 sClass = h.replaceAll(sClass, WYMeditor.CLASS_TITLE, oClass.title); 771 sClasses += sClass; 765 772 } 766 773 767 boxHtml = boxHtml.replaceAll(WYMeditor.CLASSES_ITEMS, sClasses);774 boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES_ITEMS, sClasses); 768 775 769 776 //construct containers list … … 774 781 var oContainer = aContainers[i]; 775 782 if(oContainer.name && oContainer.title) 776 sContainers += this._options.containersItemHtml777 .replaceAll(WYMeditor.CONTAINER_NAME, oContainer.name)778 .replaceAll(WYMeditor.CONTAINER_TITLE,783 var sContainer = this._options.containersItemHtml; 784 sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_NAME, oContainer.name); 785 sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_TITLE, 779 786 this._options.stringDelimiterLeft 780 787 + oContainer.title 781 + this._options.stringDelimiterRight) 782 .replaceAll(WYMeditor.CONTAINER_CLASS, oContainer.css); 788 + this._options.stringDelimiterRight); 789 sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_CLASS, oContainer.css); 790 sContainers += sContainer; 783 791 } 784 792 785 boxHtml = boxHtml.replaceAll(WYMeditor.CONTAINERS_ITEMS, sContainers);793 boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS_ITEMS, sContainers); 786 794 787 795 //l10n … … 1079 1087 //replace all the strings in sVal and return it 1080 1088 for (var key in WYMeditor.STRINGS[this._options.lang]) { 1081 sVal = sVal.replaceAll(this._options.stringDelimiterLeft + key1089 sVal = WYMeditor.Helper.replaceAll(sVal, this._options.stringDelimiterLeft + key 1082 1090 + this._options.stringDelimiterRight, 1083 1091 WYMeditor.STRINGS[this._options.lang][key]); … … 1145 1153 } 1146 1154 1155 var h = WYMeditor.Helper; 1156 1147 1157 //construct the dialog 1148 1158 var dialogHtml = this._options.dialogHtml; 1149 dialogHtml = dialogHtml 1150 .replaceAll(WYMeditor.BASE_PATH, this._options.basePath) 1151 .replaceAll(WYMeditor.CSS_PATH, this._options.skinPath 1152 + WYMeditor.SKINS_DEFAULT_CSS) 1153 .replaceAll(WYMeditor.WYM_PATH, this._options.wymPath) 1154 .replaceAll(WYMeditor.JQUERY_PATH, this._options.jQueryPath) 1155 .replaceAll(WYMeditor.DIALOG_TITLE, this.encloseString(sType)) 1156 .replaceAll(WYMeditor.DIALOG_BODY, sBodyHtml) 1157 .replaceAll(WYMeditor.INDEX, this._index); 1159 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.BASE_PATH, this._options.basePath); 1160 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.CSS_PATH, this._options.skinPath + WYMeditor.SKINS_DEFAULT_CSS); 1161 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.WYM_PATH, this._options.wymPath); 1162 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.JQUERY_PATH, this._options.jQueryPath); 1163 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.DIALOG_TITLE, this.encloseString(sType)); 1164 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.DIALOG_BODY, sBodyHtml); 1165 dialogHtml = h.replaceAll(dialogHtml, WYMeditor.INDEX, this._index); 1158 1166 1159 1167 dialogHtml = this.replaceStrings(dialogHtml); … … 3715 3723 if(!this._in_style){ 3716 3724 this._has_title = true; 3717 this._current_item = {'title': text.trim()};3725 this._current_item = {'title':WYMeditor.Helper.trim(text)}; 3718 3726 }else{ 3719 3727 if(this._current_item[this._current_element]){ … … 3733 3741 { 3734 3742 if(status == WYMeditor.LEXER_UNMATCHED){ 3735 match = match.trim();3743 match = WYMeditor.Helper.trim(match); 3736 3744 if(match != ''){ 3737 3745 this._current_item[this._current_element].style = match; … … 3791 3799 3792 3800 this.css_settings.classesItems.push({ 3793 'name': details.name.trim(),3801 'name': WYMeditor.Helper.trim(details.name), 3794 3802 'title': style_details.title, 3795 'expr' : (details.expressions||details.tags).join(', ').trim()3803 'expr' : WYMeditor.Helper.trim((details.expressions||details.tags).join(', ')) 3796 3804 }); 3797 3805 if(details.feedback_style){ 3798 3806 this.css_settings.editorStyles.push({ 3799 'name': '.'+ details.name.trim(),3807 'name': '.'+ WYMeditor.Helper.trim(details.name), 3800 3808 'css': details.feedback_style 3801 3809 }); … … 3803 3811 if(details.style){ 3804 3812 this.css_settings.dialogStyles.push({ 3805 'name': '.'+ details.name.trim(),3813 'name': '.'+ WYMeditor.Helper.trim(details.name), 3806 3814 'css': details.style 3807 3815 }); … … 3854 3862 }; 3855 3863 3856 if(!String.prototype.replaceAll) { 3857 String.prototype.replaceAll = function(old, rep) { 3864 WYMeditor.Helper = { 3865 3866 replaceAll: function(str, old, rep) { 3858 3867 var rExp = new RegExp(old, "g"); 3859 return(this.replace(rExp, rep)); 3860 }; 3861 }; 3862 3863 if(!String.prototype.trim) { 3864 String.prototype.trim = function() { 3865 return this.replace(/^(\s*)|(\s*)$/gm,''); 3866 }; 3868 return(str.replace(rExp, rep)); 3869 }, 3870 3871 trim: function(str) { 3872 return str.replace(/^(\s*)|(\s*)$/gm,''); 3873 } 3867 3874 }; 3868 3875
Note: See TracChangeset
for help on using the changeset viewer.