@@ -1,49 +1,46 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | module Redmine |
|
19 | 19 | module WikiFormatting |
|
20 | 20 | module Textile |
|
21 | 21 | module Helper |
|
22 | 22 | def wikitoolbar_for(field_id) |
|
23 | 23 | heads_for_wiki_formatter |
|
24 | 24 | # Is there a simple way to link to a public resource? |
|
25 | 25 | url = "#{Redmine::Utils.relative_url_root}/help/wiki_syntax.html" |
|
26 | help_link = link_to(l(:setting_text_formatting), url, | |
|
27 | :onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;") | |
|
28 | ||
|
29 | javascript_tag("var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript help_link}'); wikiToolbar.draw();") | |
|
26 | javascript_tag("var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript url}'); wikiToolbar.draw();") | |
|
30 | 27 | end |
|
31 | 28 | |
|
32 | 29 | def initial_page_content(page) |
|
33 | 30 | "h1. #{@page.pretty_title}" |
|
34 | 31 | end |
|
35 | 32 | |
|
36 | 33 | def heads_for_wiki_formatter |
|
37 | 34 | unless @heads_for_wiki_formatter_included |
|
38 | 35 | content_for :header_tags do |
|
39 | 36 | javascript_include_tag('jstoolbar/jstoolbar-textile.min') + |
|
40 | 37 | javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") + |
|
41 | 38 | stylesheet_link_tag('jstoolbar') |
|
42 | 39 | end |
|
43 | 40 | @heads_for_wiki_formatter_included = true |
|
44 | 41 | end |
|
45 | 42 | end |
|
46 | 43 | end |
|
47 | 44 | end |
|
48 | 45 | end |
|
49 | 46 | end |
@@ -1,1 +1,2 | |||
|
1 |
function jsToolBar(e){if(!document.createElement){return}if(!e){return}if(typeof document["selection"]=="undefined"&&typeof e["setSelectionRange"]=="undefined"){return}this.textarea=e;this.editor=document.createElement("div");this.editor.className="jstEditor";this.textarea.parentNode.insertBefore(this.editor,this.textarea);this.editor.appendChild(this.textarea);this.toolbar=document.createElement("div");this.toolbar.className="jstElements";this.editor.parentNode.insertBefore(this.toolbar,this.editor);if(this.editor.addEventListener&&navigator.appVersion.match(/\bMSIE\b/)){this.handle=document.createElement("div");this.handle.className="jstHandle";var t=this.resizeDragStart;var n=this;this.handle.addEventListener("mousedown",function(e){t.call(n,e)},false);window.addEventListener("unload",function(){var e=n.handle.parentNode.removeChild(n.handle);delete n.handle},false);this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling)}this.context=null;this.toolNodes={}}function jsButton(e,t,n,r){if(typeof jsToolBar.strings=="undefined"){this.title=e||null}else{this.title=jsToolBar.strings[e]||e||null}this.fn=t||function(){};this.scope=n||null;this.className=r||null}function jsSpace(e){this.id=e||null;this.width=null}function jsCombo(e,t,n,r,i){this.title=e||null;this.options=t||null;this.scope=n||null;this.fn=r||function(){};this.className=i||null}jsButton.prototype.draw=function(){if(!this.scope)return null;var e=document.createElement("button");e.setAttribute("type","button");e.tabIndex=200;if(this.className)e.className=this.className;e.title=this.title;var t=document.createElement("span");t.appendChild(document.createTextNode(this.title));e.appendChild(t);if(this.icon!=undefined){e.style.backgroundImage="url("+this.icon+")"}if(typeof this.fn=="function"){var n=this;e.onclick=function(){try{n.fn.apply(n.scope,arguments)}catch(e){}return false}}return e};jsSpace.prototype.draw=function(){var e=document.createElement("span");if(this.id)e.id=this.id;e.appendChild(document.createTextNode(String.fromCharCode(160)));e.className="jstSpacer";if(this.width)e.style.marginRight=this.width+"px";return e};jsCombo.prototype.draw=function(){if(!this.scope||!this.options)return null;var e=document.createElement("select");if(this.className)e.className=className;e.title=this.title;for(var t in this.options){var n=document.createElement("option");n.value=t;n.appendChild(document.createTextNode(this.options[t]));e.appendChild(n)}var r=this;e.onchange=function(){try{r.fn.call(r.scope,this.value)}catch(e){alert(e)}return false};return e};jsToolBar.prototype={base_url:"",mode:"wiki",elements:{},help_link:"",getMode:function(){return this.mode},setMode:function(e){this.mode=e||"wiki"},switchMode:function(e){e=e||"wiki";this.draw(e)},setHelpLink:function(e){this.help_link=e},button:function(e){var t=this.elements[e];if(typeof t.fn[this.mode]!="function")return null;var n=new jsButton(t.title,t.fn[this.mode],this,"jstb_"+e);if(t.icon!=undefined)n.icon=t.icon;return n},space:function(e){var t=new jsSpace(e);if(this.elements[e].width!==undefined)t.width=this.elements[e].width;return t},combo:function(e){var t=this.elements[e];var n=t[this.mode].list.length;if(typeof t[this.mode].fn!="function"||n==0){return null}else{var r={};for(var i=0;i<n;i++){var s=t[this.mode].list[i];r[s]=t.options[s]}return new jsCombo(t.title,r,this,t[this.mode].fn)}},draw:function(e){this.setMode(e);while(this.toolbar.hasChildNodes()){this.toolbar.removeChild(this.toolbar.firstChild)}this.toolNodes={};var t |
|
|
1 | function jsToolBar(e){if(!document.createElement){return}if(!e){return}if(typeof document["selection"]=="undefined"&&typeof e["setSelectionRange"]=="undefined"){return}this.textarea=e;this.editor=document.createElement("div");this.editor.className="jstEditor";this.textarea.parentNode.insertBefore(this.editor,this.textarea);this.editor.appendChild(this.textarea);this.toolbar=document.createElement("div");this.toolbar.className="jstElements";this.editor.parentNode.insertBefore(this.toolbar,this.editor);if(this.editor.addEventListener&&navigator.appVersion.match(/\bMSIE\b/)){this.handle=document.createElement("div");this.handle.className="jstHandle";var t=this.resizeDragStart;var n=this;this.handle.addEventListener("mousedown",function(e){t.call(n,e)},false);window.addEventListener("unload",function(){var e=n.handle.parentNode.removeChild(n.handle);delete n.handle},false);this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling)}this.context=null;this.toolNodes={}}function jsButton(e,t,n,r){if(typeof jsToolBar.strings=="undefined"){this.title=e||null}else{this.title=jsToolBar.strings[e]||e||null}this.fn=t||function(){};this.scope=n||null;this.className=r||null}function jsSpace(e){this.id=e||null;this.width=null}function jsCombo(e,t,n,r,i){this.title=e||null;this.options=t||null;this.scope=n||null;this.fn=r||function(){};this.className=i||null}jsButton.prototype.draw=function(){if(!this.scope)return null;var e=document.createElement("button");e.setAttribute("type","button");e.tabIndex=200;if(this.className)e.className=this.className;e.title=this.title;var t=document.createElement("span");t.appendChild(document.createTextNode(this.title));e.appendChild(t);if(this.icon!=undefined){e.style.backgroundImage="url("+this.icon+")"}if(typeof this.fn=="function"){var n=this;e.onclick=function(){try{n.fn.apply(n.scope,arguments)}catch(e){}return false}}return e};jsSpace.prototype.draw=function(){var e=document.createElement("span");if(this.id)e.id=this.id;e.appendChild(document.createTextNode(String.fromCharCode(160)));e.className="jstSpacer";if(this.width)e.style.marginRight=this.width+"px";return e};jsCombo.prototype.draw=function(){if(!this.scope||!this.options)return null;var e=document.createElement("select");if(this.className)e.className=className;e.title=this.title;for(var t in this.options){var n=document.createElement("option");n.value=t;n.appendChild(document.createTextNode(this.options[t]));e.appendChild(n)}var r=this;e.onchange=function(){try{r.fn.call(r.scope,this.value)}catch(e){alert(e)}return false};return e};jsToolBar.prototype={base_url:"",mode:"wiki",elements:{},help_link:"",getMode:function(){return this.mode},setMode:function(e){this.mode=e||"wiki"},switchMode:function(e){e=e||"wiki";this.draw(e)},setHelpLink:function(e){this.help_link=e},button:function(e){var t=this.elements[e];if(typeof t.fn[this.mode]!="function")return null;var n=new jsButton(t.title,t.fn[this.mode],this,"jstb_"+e);if(t.icon!=undefined)n.icon=t.icon;return n},space:function(e){var t=new jsSpace(e);if(this.elements[e].width!==undefined)t.width=this.elements[e].width;return t},combo:function(e){var t=this.elements[e];var n=t[this.mode].list.length;if(typeof t[this.mode].fn!="function"||n==0){return null}else{var r={};for(var i=0;i<n;i++){var s=t[this.mode].list[i];r[s]=t.options[s]}return new jsCombo(t.title,r,this,t[this.mode].fn)}},draw:function(e){this.setMode(e);while(this.toolbar.hasChildNodes()){this.toolbar.removeChild(this.toolbar.firstChild)}this.toolNodes={};var t,n,r;for(var i in this.elements){t=this.elements[i];var s=t.type==undefined||t.type==""||t.disabled!=undefined&&t.disabled||t.context!=undefined&&t.context!=null&&t.context!=this.context;if(!s&&typeof this[t.type]=="function"){n=this[t.type](i);if(n)r=n.draw();if(r){this.toolNodes[i]=r;this.toolbar.appendChild(r)}}}},singleTag:function(e,t){e=e||null;t=t||e;if(!e||!t){return}this.encloseSelection(e,t)},encloseLineSelection:function(e,t,n){this.textarea.focus();e=e||"";t=t||"";var r,i,s,o,u,a;if(typeof document["selection"]!="undefined"){s=document.selection.createRange().text}else if(typeof this.textarea["setSelectionRange"]!="undefined"){r=this.textarea.selectionStart;i=this.textarea.selectionEnd;o=this.textarea.scrollTop;r=this.textarea.value.substring(0,r).replace(/[^\r\n]*$/g,"").length;i=this.textarea.value.length-this.textarea.value.substring(i,this.textarea.value.length).replace(/^[^\r\n]*/,"").length;s=this.textarea.value.substring(r,i)}if(s.match(/ $/)){s=s.substring(0,s.length-1);t=t+" "}if(typeof n=="function"){a=s?n.call(this,s):n("")}else{a=s?s:""}u=e+a+t;if(typeof document["selection"]!="undefined"){document.selection.createRange().text=u;var f=this.textarea.createTextRange();f.collapse(false);f.move("character",-t.length);f.select()}else if(typeof this.textarea["setSelectionRange"]!="undefined"){this.textarea.value=this.textarea.value.substring(0,r)+u+this.textarea.value.substring(i);if(s){this.textarea.setSelectionRange(r+u.length,r+u.length)}else{this.textarea.setSelectionRange(r+e.length,r+e.length)}this.textarea.scrollTop=o}},encloseSelection:function(e,t,n){this.textarea.focus();e=e||"";t=t||"";var r,i,s,o,u,a;if(typeof document["selection"]!="undefined"){s=document.selection.createRange().text}else if(typeof this.textarea["setSelectionRange"]!="undefined"){r=this.textarea.selectionStart;i=this.textarea.selectionEnd;o=this.textarea.scrollTop;s=this.textarea.value.substring(r,i)}if(s.match(/ $/)){s=s.substring(0,s.length-1);t=t+" "}if(typeof n=="function"){a=s?n.call(this,s):n("")}else{a=s?s:""}u=e+a+t;if(typeof document["selection"]!="undefined"){document.selection.createRange().text=u;var f=this.textarea.createTextRange();f.collapse(false);f.move("character",-t.length);f.select()}else if(typeof this.textarea["setSelectionRange"]!="undefined"){this.textarea.value=this.textarea.value.substring(0,r)+u+this.textarea.value.substring(i);if(s){this.textarea.setSelectionRange(r+u.length,r+u.length)}else{this.textarea.setSelectionRange(r+e.length,r+e.length)}this.textarea.scrollTop=o}},stripBaseURL:function(e){if(this.base_url!=""){var t=e.indexOf(this.base_url);if(t==0){e=e.substr(this.base_url.length)}}return e}};jsToolBar.prototype.resizeSetStartH=function(){this.dragStartH=this.textarea.offsetHeight+0};jsToolBar.prototype.resizeDragStart=function(e){var t=this;this.dragStartY=e.clientY;this.resizeSetStartH();document.addEventListener("mousemove",this.dragMoveHdlr=function(e){t.resizeDragMove(e)},false);document.addEventListener("mouseup",this.dragStopHdlr=function(e){t.resizeDragStop(e)},false)};jsToolBar.prototype.resizeDragMove=function(e){this.textarea.style.height=this.dragStartH+e.clientY-this.dragStartY+"px"};jsToolBar.prototype.resizeDragStop=function(e){document.removeEventListener("mousemove",this.dragMoveHdlr,false);document.removeEventListener("mouseup",this.dragStopHdlr,false)}; | |
|
2 | jsToolBar.prototype.elements.strong={type:"button",title:"Strong",fn:{wiki:function(){this.singleTag("*")}}};jsToolBar.prototype.elements.em={type:"button",title:"Italic",fn:{wiki:function(){this.singleTag("_")}}};jsToolBar.prototype.elements.ins={type:"button",title:"Underline",fn:{wiki:function(){this.singleTag("+")}}};jsToolBar.prototype.elements.del={type:"button",title:"Deleted",fn:{wiki:function(){this.singleTag("-")}}};jsToolBar.prototype.elements.code={type:"button",title:"Code",fn:{wiki:function(){this.singleTag("@")}}};jsToolBar.prototype.elements.space1={type:"space"};jsToolBar.prototype.elements.h1={type:"button",title:"Heading 1",fn:{wiki:function(){this.encloseLineSelection("h1. ","",function(e){e=e.replace(/^h\d+\.\s+/,"");return e})}}};jsToolBar.prototype.elements.h2={type:"button",title:"Heading 2",fn:{wiki:function(){this.encloseLineSelection("h2. ","",function(e){e=e.replace(/^h\d+\.\s+/,"");return e})}}};jsToolBar.prototype.elements.h3={type:"button",title:"Heading 3",fn:{wiki:function(){this.encloseLineSelection("h3. ","",function(e){e=e.replace(/^h\d+\.\s+/,"");return e})}}};jsToolBar.prototype.elements.space2={type:"space"};jsToolBar.prototype.elements.ul={type:"button",title:"Unordered list",fn:{wiki:function(){this.encloseLineSelection("","",function(e){e=e.replace(/\r/g,"");return e.replace(/(\n|^)[#-]?\s*/g,"$1* ")})}}};jsToolBar.prototype.elements.ol={type:"button",title:"Ordered list",fn:{wiki:function(){this.encloseLineSelection("","",function(e){e=e.replace(/\r/g,"");return e.replace(/(\n|^)[*-]?\s*/g,"$1# ")})}}};jsToolBar.prototype.elements.space3={type:"space"};jsToolBar.prototype.elements.bq={type:"button",title:"Quote",fn:{wiki:function(){this.encloseLineSelection("","",function(e){e=e.replace(/\r/g,"");return e.replace(/(\n|^) *([^\n]*)/g,"$1> $2")})}}};jsToolBar.prototype.elements.unbq={type:"button",title:"Unquote",fn:{wiki:function(){this.encloseLineSelection("","",function(e){e=e.replace(/\r/g,"");return e.replace(/(\n|^) *[>]? *([^\n]*)/g,"$1$2")})}}};jsToolBar.prototype.elements.pre={type:"button",title:"Preformatted text",fn:{wiki:function(){this.encloseLineSelection("<pre>\n","\n</pre>")}}};jsToolBar.prototype.elements.space4={type:"space"};jsToolBar.prototype.elements.link={type:"button",title:"Wiki link",fn:{wiki:function(){this.encloseSelection("[[","]]")}}};jsToolBar.prototype.elements.img={type:"button",title:"Image",fn:{wiki:function(){this.encloseSelection("!","!")}}};jsToolBar.prototype.elements.space5={type:"space"};jsToolBar.prototype.elements.help={type:"button",title:"Help",fn:{wiki:function(){window.open(this.help_link,"","resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes")}}} |
@@ -1,380 +1,374 | |||
|
1 | 1 | /* ***** BEGIN LICENSE BLOCK ***** |
|
2 | 2 | * This file is part of DotClear. |
|
3 | 3 | * Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All |
|
4 | 4 | * rights reserved. |
|
5 | 5 | * |
|
6 | 6 | * DotClear is free software; you can redistribute it and/or modify |
|
7 | 7 | * it under the terms of the GNU General Public License as published by |
|
8 | 8 | * the Free Software Foundation; either version 2 of the License, or |
|
9 | 9 | * (at your option) any later version. |
|
10 | 10 | * |
|
11 | 11 | * DotClear is distributed in the hope that it will be useful, |
|
12 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | * GNU General Public License for more details. |
|
15 | 15 | * |
|
16 | 16 | * You should have received a copy of the GNU General Public License |
|
17 | 17 | * along with DotClear; if not, write to the Free Software |
|
18 | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
19 | 19 | * |
|
20 | 20 | * ***** END LICENSE BLOCK ***** |
|
21 | 21 | */ |
|
22 | 22 | |
|
23 | 23 | /* Modified by JP LANG for textile formatting */ |
|
24 | 24 | |
|
25 | 25 | function jsToolBar(textarea) { |
|
26 | 26 | if (!document.createElement) { return; } |
|
27 | 27 | |
|
28 | 28 | if (!textarea) { return; } |
|
29 | 29 | |
|
30 | 30 | if ((typeof(document["selection"]) == "undefined") |
|
31 | 31 | && (typeof(textarea["setSelectionRange"]) == "undefined")) { |
|
32 | 32 | return; |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | this.textarea = textarea; |
|
36 | 36 | |
|
37 | 37 | this.editor = document.createElement('div'); |
|
38 | 38 | this.editor.className = 'jstEditor'; |
|
39 | 39 | |
|
40 | 40 | this.textarea.parentNode.insertBefore(this.editor,this.textarea); |
|
41 | 41 | this.editor.appendChild(this.textarea); |
|
42 | 42 | |
|
43 | 43 | this.toolbar = document.createElement("div"); |
|
44 | 44 | this.toolbar.className = 'jstElements'; |
|
45 | 45 | this.editor.parentNode.insertBefore(this.toolbar,this.editor); |
|
46 | 46 | |
|
47 | 47 | // Dragable resizing |
|
48 | 48 | if (this.editor.addEventListener && navigator.appVersion.match(/\bMSIE\b/)) |
|
49 | 49 | { |
|
50 | 50 | this.handle = document.createElement('div'); |
|
51 | 51 | this.handle.className = 'jstHandle'; |
|
52 | 52 | var dragStart = this.resizeDragStart; |
|
53 | 53 | var This = this; |
|
54 | 54 | this.handle.addEventListener('mousedown',function(event) { dragStart.call(This,event); },false); |
|
55 | 55 | // fix memory leak in Firefox (bug #241518) |
|
56 | 56 | window.addEventListener('unload',function() { |
|
57 | 57 | var del = This.handle.parentNode.removeChild(This.handle); |
|
58 | 58 | delete(This.handle); |
|
59 | 59 | },false); |
|
60 | 60 | |
|
61 | 61 | this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling); |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | this.context = null; |
|
65 | 65 | this.toolNodes = {}; // lorsque la toolbar est dessinΓ©e , cet objet est garni |
|
66 | 66 | // de raccourcis vers les Γ©lΓ©ments DOM correspondants aux outils. |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | function jsButton(title, fn, scope, className) { |
|
70 | 70 | if(typeof jsToolBar.strings == 'undefined') { |
|
71 | 71 | this.title = title || null; |
|
72 | 72 | } else { |
|
73 | 73 | this.title = jsToolBar.strings[title] || title || null; |
|
74 | 74 | } |
|
75 | 75 | this.fn = fn || function(){}; |
|
76 | 76 | this.scope = scope || null; |
|
77 | 77 | this.className = className || null; |
|
78 | 78 | } |
|
79 | 79 | jsButton.prototype.draw = function() { |
|
80 | 80 | if (!this.scope) return null; |
|
81 | 81 | |
|
82 | 82 | var button = document.createElement('button'); |
|
83 | 83 | button.setAttribute('type','button'); |
|
84 | 84 | button.tabIndex = 200; |
|
85 | 85 | if (this.className) button.className = this.className; |
|
86 | 86 | button.title = this.title; |
|
87 | 87 | var span = document.createElement('span'); |
|
88 | 88 | span.appendChild(document.createTextNode(this.title)); |
|
89 | 89 | button.appendChild(span); |
|
90 | 90 | |
|
91 | 91 | if (this.icon != undefined) { |
|
92 | 92 | button.style.backgroundImage = 'url('+this.icon+')'; |
|
93 | 93 | } |
|
94 | 94 | if (typeof(this.fn) == 'function') { |
|
95 | 95 | var This = this; |
|
96 | 96 | button.onclick = function() { try { This.fn.apply(This.scope, arguments) } catch (e) {} return false; }; |
|
97 | 97 | } |
|
98 | 98 | return button; |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | function jsSpace(id) { |
|
102 | 102 | this.id = id || null; |
|
103 | 103 | this.width = null; |
|
104 | 104 | } |
|
105 | 105 | jsSpace.prototype.draw = function() { |
|
106 | 106 | var span = document.createElement('span'); |
|
107 | 107 | if (this.id) span.id = this.id; |
|
108 | 108 | span.appendChild(document.createTextNode(String.fromCharCode(160))); |
|
109 | 109 | span.className = 'jstSpacer'; |
|
110 | 110 | if (this.width) span.style.marginRight = this.width+'px'; |
|
111 | 111 | |
|
112 | 112 | return span; |
|
113 | 113 | } |
|
114 | 114 | |
|
115 | 115 | function jsCombo(title, options, scope, fn, className) { |
|
116 | 116 | this.title = title || null; |
|
117 | 117 | this.options = options || null; |
|
118 | 118 | this.scope = scope || null; |
|
119 | 119 | this.fn = fn || function(){}; |
|
120 | 120 | this.className = className || null; |
|
121 | 121 | } |
|
122 | 122 | jsCombo.prototype.draw = function() { |
|
123 | 123 | if (!this.scope || !this.options) return null; |
|
124 | 124 | |
|
125 | 125 | var select = document.createElement('select'); |
|
126 | 126 | if (this.className) select.className = className; |
|
127 | 127 | select.title = this.title; |
|
128 | 128 | |
|
129 | 129 | for (var o in this.options) { |
|
130 | 130 | //var opt = this.options[o]; |
|
131 | 131 | var option = document.createElement('option'); |
|
132 | 132 | option.value = o; |
|
133 | 133 | option.appendChild(document.createTextNode(this.options[o])); |
|
134 | 134 | select.appendChild(option); |
|
135 | 135 | } |
|
136 | 136 | |
|
137 | 137 | var This = this; |
|
138 | 138 | select.onchange = function() { |
|
139 | 139 | try { |
|
140 | 140 | This.fn.call(This.scope, this.value); |
|
141 | 141 | } catch (e) { alert(e); } |
|
142 | 142 | |
|
143 | 143 | return false; |
|
144 | 144 | } |
|
145 | 145 | |
|
146 | 146 | return select; |
|
147 | 147 | } |
|
148 | 148 | |
|
149 | 149 | |
|
150 | 150 | jsToolBar.prototype = { |
|
151 | 151 | base_url: '', |
|
152 | 152 | mode: 'wiki', |
|
153 | 153 | elements: {}, |
|
154 | 154 | help_link: '', |
|
155 | 155 | |
|
156 | 156 | getMode: function() { |
|
157 | 157 | return this.mode; |
|
158 | 158 | }, |
|
159 | 159 | |
|
160 | 160 | setMode: function(mode) { |
|
161 | 161 | this.mode = mode || 'wiki'; |
|
162 | 162 | }, |
|
163 | 163 | |
|
164 | 164 | switchMode: function(mode) { |
|
165 | 165 | mode = mode || 'wiki'; |
|
166 | 166 | this.draw(mode); |
|
167 | 167 | }, |
|
168 | 168 | |
|
169 | 169 | setHelpLink: function(link) { |
|
170 | 170 | this.help_link = link; |
|
171 | 171 | }, |
|
172 | 172 | |
|
173 | 173 | button: function(toolName) { |
|
174 | 174 | var tool = this.elements[toolName]; |
|
175 | 175 | if (typeof tool.fn[this.mode] != 'function') return null; |
|
176 | 176 | var b = new jsButton(tool.title, tool.fn[this.mode], this, 'jstb_'+toolName); |
|
177 | 177 | if (tool.icon != undefined) b.icon = tool.icon; |
|
178 | 178 | return b; |
|
179 | 179 | }, |
|
180 | 180 | space: function(toolName) { |
|
181 | 181 | var tool = new jsSpace(toolName) |
|
182 | 182 | if (this.elements[toolName].width !== undefined) |
|
183 | 183 | tool.width = this.elements[toolName].width; |
|
184 | 184 | return tool; |
|
185 | 185 | }, |
|
186 | 186 | combo: function(toolName) { |
|
187 | 187 | var tool = this.elements[toolName]; |
|
188 | 188 | var length = tool[this.mode].list.length; |
|
189 | 189 | |
|
190 | 190 | if (typeof tool[this.mode].fn != 'function' || length == 0) { |
|
191 | 191 | return null; |
|
192 | 192 | } else { |
|
193 | 193 | var options = {}; |
|
194 | 194 | for (var i=0; i < length; i++) { |
|
195 | 195 | var opt = tool[this.mode].list[i]; |
|
196 | 196 | options[opt] = tool.options[opt]; |
|
197 | 197 | } |
|
198 | 198 | return new jsCombo(tool.title, options, this, tool[this.mode].fn); |
|
199 | 199 | } |
|
200 | 200 | }, |
|
201 | 201 | draw: function(mode) { |
|
202 | 202 | this.setMode(mode); |
|
203 | 203 | |
|
204 | 204 | // Empty toolbar |
|
205 | 205 | while (this.toolbar.hasChildNodes()) { |
|
206 | 206 | this.toolbar.removeChild(this.toolbar.firstChild) |
|
207 | 207 | } |
|
208 | 208 | this.toolNodes = {}; // vide les raccourcis DOM/**/ |
|
209 | 209 | |
|
210 | var h = document.createElement('div'); | |
|
211 | h.className = 'help' | |
|
212 | h.innerHTML = this.help_link; | |
|
213 | '<a href="/help/wiki_syntax.html" onclick="window.open(\'/help/wiki_syntax.html\', \'\', \'resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\'); return false;">Aide</a>'; | |
|
214 | this.toolbar.appendChild(h); | |
|
215 | ||
|
216 | 210 | // Draw toolbar elements |
|
217 | 211 | var b, tool, newTool; |
|
218 | 212 | |
|
219 | 213 | for (var i in this.elements) { |
|
220 | 214 | b = this.elements[i]; |
|
221 | 215 | |
|
222 | 216 | var disabled = |
|
223 | 217 | b.type == undefined || b.type == '' |
|
224 | 218 | || (b.disabled != undefined && b.disabled) |
|
225 | 219 | || (b.context != undefined && b.context != null && b.context != this.context); |
|
226 | 220 | |
|
227 | 221 | if (!disabled && typeof this[b.type] == 'function') { |
|
228 | 222 | tool = this[b.type](i); |
|
229 | 223 | if (tool) newTool = tool.draw(); |
|
230 | 224 | if (newTool) { |
|
231 | 225 | this.toolNodes[i] = newTool; //mémorise l'accès DOM pour usage éventuel ultérieur |
|
232 | 226 | this.toolbar.appendChild(newTool); |
|
233 | 227 | } |
|
234 | 228 | } |
|
235 | 229 | } |
|
236 | 230 | }, |
|
237 | 231 | |
|
238 | 232 | singleTag: function(stag,etag) { |
|
239 | 233 | stag = stag || null; |
|
240 | 234 | etag = etag || stag; |
|
241 | 235 | |
|
242 | 236 | if (!stag || !etag) { return; } |
|
243 | 237 | |
|
244 | 238 | this.encloseSelection(stag,etag); |
|
245 | 239 | }, |
|
246 | 240 | |
|
247 | 241 | encloseLineSelection: function(prefix, suffix, fn) { |
|
248 | 242 | this.textarea.focus(); |
|
249 | 243 | |
|
250 | 244 | prefix = prefix || ''; |
|
251 | 245 | suffix = suffix || ''; |
|
252 | 246 | |
|
253 | 247 | var start, end, sel, scrollPos, subst, res; |
|
254 | 248 | |
|
255 | 249 | if (typeof(document["selection"]) != "undefined") { |
|
256 | 250 | sel = document.selection.createRange().text; |
|
257 | 251 | } else if (typeof(this.textarea["setSelectionRange"]) != "undefined") { |
|
258 | 252 | start = this.textarea.selectionStart; |
|
259 | 253 | end = this.textarea.selectionEnd; |
|
260 | 254 | scrollPos = this.textarea.scrollTop; |
|
261 | 255 | // go to the start of the line |
|
262 | 256 | start = this.textarea.value.substring(0, start).replace(/[^\r\n]*$/g,'').length; |
|
263 | 257 | // go to the end of the line |
|
264 | 258 | end = this.textarea.value.length - this.textarea.value.substring(end, this.textarea.value.length).replace(/^[^\r\n]*/, '').length; |
|
265 | 259 | sel = this.textarea.value.substring(start, end); |
|
266 | 260 | } |
|
267 | 261 | |
|
268 | 262 | if (sel.match(/ $/)) { // exclude ending space char, if any |
|
269 | 263 | sel = sel.substring(0, sel.length - 1); |
|
270 | 264 | suffix = suffix + " "; |
|
271 | 265 | } |
|
272 | 266 | |
|
273 | 267 | if (typeof(fn) == 'function') { |
|
274 | 268 | res = (sel) ? fn.call(this,sel) : fn(''); |
|
275 | 269 | } else { |
|
276 | 270 | res = (sel) ? sel : ''; |
|
277 | 271 | } |
|
278 | 272 | |
|
279 | 273 | subst = prefix + res + suffix; |
|
280 | 274 | |
|
281 | 275 | if (typeof(document["selection"]) != "undefined") { |
|
282 | 276 | document.selection.createRange().text = subst; |
|
283 | 277 | var range = this.textarea.createTextRange(); |
|
284 | 278 | range.collapse(false); |
|
285 | 279 | range.move('character', -suffix.length); |
|
286 | 280 | range.select(); |
|
287 | 281 | } else if (typeof(this.textarea["setSelectionRange"]) != "undefined") { |
|
288 | 282 | this.textarea.value = this.textarea.value.substring(0, start) + subst + |
|
289 | 283 | this.textarea.value.substring(end); |
|
290 | 284 | if (sel) { |
|
291 | 285 | this.textarea.setSelectionRange(start + subst.length, start + subst.length); |
|
292 | 286 | } else { |
|
293 | 287 | this.textarea.setSelectionRange(start + prefix.length, start + prefix.length); |
|
294 | 288 | } |
|
295 | 289 | this.textarea.scrollTop = scrollPos; |
|
296 | 290 | } |
|
297 | 291 | }, |
|
298 | 292 | |
|
299 | 293 | encloseSelection: function(prefix, suffix, fn) { |
|
300 | 294 | this.textarea.focus(); |
|
301 | 295 | |
|
302 | 296 | prefix = prefix || ''; |
|
303 | 297 | suffix = suffix || ''; |
|
304 | 298 | |
|
305 | 299 | var start, end, sel, scrollPos, subst, res; |
|
306 | 300 | |
|
307 | 301 | if (typeof(document["selection"]) != "undefined") { |
|
308 | 302 | sel = document.selection.createRange().text; |
|
309 | 303 | } else if (typeof(this.textarea["setSelectionRange"]) != "undefined") { |
|
310 | 304 | start = this.textarea.selectionStart; |
|
311 | 305 | end = this.textarea.selectionEnd; |
|
312 | 306 | scrollPos = this.textarea.scrollTop; |
|
313 | 307 | sel = this.textarea.value.substring(start, end); |
|
314 | 308 | } |
|
315 | 309 | |
|
316 | 310 | if (sel.match(/ $/)) { // exclude ending space char, if any |
|
317 | 311 | sel = sel.substring(0, sel.length - 1); |
|
318 | 312 | suffix = suffix + " "; |
|
319 | 313 | } |
|
320 | 314 | |
|
321 | 315 | if (typeof(fn) == 'function') { |
|
322 | 316 | res = (sel) ? fn.call(this,sel) : fn(''); |
|
323 | 317 | } else { |
|
324 | 318 | res = (sel) ? sel : ''; |
|
325 | 319 | } |
|
326 | 320 | |
|
327 | 321 | subst = prefix + res + suffix; |
|
328 | 322 | |
|
329 | 323 | if (typeof(document["selection"]) != "undefined") { |
|
330 | 324 | document.selection.createRange().text = subst; |
|
331 | 325 | var range = this.textarea.createTextRange(); |
|
332 | 326 | range.collapse(false); |
|
333 | 327 | range.move('character', -suffix.length); |
|
334 | 328 | range.select(); |
|
335 | 329 | // this.textarea.caretPos -= suffix.length; |
|
336 | 330 | } else if (typeof(this.textarea["setSelectionRange"]) != "undefined") { |
|
337 | 331 | this.textarea.value = this.textarea.value.substring(0, start) + subst + |
|
338 | 332 | this.textarea.value.substring(end); |
|
339 | 333 | if (sel) { |
|
340 | 334 | this.textarea.setSelectionRange(start + subst.length, start + subst.length); |
|
341 | 335 | } else { |
|
342 | 336 | this.textarea.setSelectionRange(start + prefix.length, start + prefix.length); |
|
343 | 337 | } |
|
344 | 338 | this.textarea.scrollTop = scrollPos; |
|
345 | 339 | } |
|
346 | 340 | }, |
|
347 | 341 | |
|
348 | 342 | stripBaseURL: function(url) { |
|
349 | 343 | if (this.base_url != '') { |
|
350 | 344 | var pos = url.indexOf(this.base_url); |
|
351 | 345 | if (pos == 0) { |
|
352 | 346 | url = url.substr(this.base_url.length); |
|
353 | 347 | } |
|
354 | 348 | } |
|
355 | 349 | |
|
356 | 350 | return url; |
|
357 | 351 | } |
|
358 | 352 | }; |
|
359 | 353 | |
|
360 | 354 | /** Resizer |
|
361 | 355 | -------------------------------------------------------- */ |
|
362 | 356 | jsToolBar.prototype.resizeSetStartH = function() { |
|
363 | 357 | this.dragStartH = this.textarea.offsetHeight + 0; |
|
364 | 358 | }; |
|
365 | 359 | jsToolBar.prototype.resizeDragStart = function(event) { |
|
366 | 360 | var This = this; |
|
367 | 361 | this.dragStartY = event.clientY; |
|
368 | 362 | this.resizeSetStartH(); |
|
369 | 363 | document.addEventListener('mousemove', this.dragMoveHdlr=function(event){This.resizeDragMove(event);}, false); |
|
370 | 364 | document.addEventListener('mouseup', this.dragStopHdlr=function(event){This.resizeDragStop(event);}, false); |
|
371 | 365 | }; |
|
372 | 366 | |
|
373 | 367 | jsToolBar.prototype.resizeDragMove = function(event) { |
|
374 | 368 | this.textarea.style.height = (this.dragStartH+event.clientY-this.dragStartY)+'px'; |
|
375 | 369 | }; |
|
376 | 370 | |
|
377 | 371 | jsToolBar.prototype.resizeDragStop = function(event) { |
|
378 | 372 | document.removeEventListener('mousemove', this.dragMoveHdlr, false); |
|
379 | 373 | document.removeEventListener('mouseup', this.dragStopHdlr, false); |
|
380 | 374 | }; |
@@ -1,200 +1,211 | |||
|
1 | 1 | /* ***** BEGIN LICENSE BLOCK ***** |
|
2 | 2 | * This file is part of DotClear. |
|
3 | 3 | * Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All |
|
4 | 4 | * rights reserved. |
|
5 | 5 | * |
|
6 | 6 | * DotClear is free software; you can redistribute it and/or modify |
|
7 | 7 | * it under the terms of the GNU General Public License as published by |
|
8 | 8 | * the Free Software Foundation; either version 2 of the License, or |
|
9 | 9 | * (at your option) any later version. |
|
10 | 10 | * |
|
11 | 11 | * DotClear is distributed in the hope that it will be useful, |
|
12 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | * GNU General Public License for more details. |
|
15 | 15 | * |
|
16 | 16 | * You should have received a copy of the GNU General Public License |
|
17 | 17 | * along with DotClear; if not, write to the Free Software |
|
18 | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
19 | 19 | * |
|
20 | 20 | * ***** END LICENSE BLOCK ***** |
|
21 | 21 | */ |
|
22 | 22 | |
|
23 | 23 | /* Modified by JP LANG for textile formatting */ |
|
24 | 24 | |
|
25 | 25 | // strong |
|
26 | 26 | jsToolBar.prototype.elements.strong = { |
|
27 | 27 | type: 'button', |
|
28 | 28 | title: 'Strong', |
|
29 | 29 | fn: { |
|
30 | 30 | wiki: function() { this.singleTag('*') } |
|
31 | 31 | } |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | // em |
|
35 | 35 | jsToolBar.prototype.elements.em = { |
|
36 | 36 | type: 'button', |
|
37 | 37 | title: 'Italic', |
|
38 | 38 | fn: { |
|
39 | 39 | wiki: function() { this.singleTag("_") } |
|
40 | 40 | } |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | // ins |
|
44 | 44 | jsToolBar.prototype.elements.ins = { |
|
45 | 45 | type: 'button', |
|
46 | 46 | title: 'Underline', |
|
47 | 47 | fn: { |
|
48 | 48 | wiki: function() { this.singleTag('+') } |
|
49 | 49 | } |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | // del |
|
53 | 53 | jsToolBar.prototype.elements.del = { |
|
54 | 54 | type: 'button', |
|
55 | 55 | title: 'Deleted', |
|
56 | 56 | fn: { |
|
57 | 57 | wiki: function() { this.singleTag('-') } |
|
58 | 58 | } |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | // code |
|
62 | 62 | jsToolBar.prototype.elements.code = { |
|
63 | 63 | type: 'button', |
|
64 | 64 | title: 'Code', |
|
65 | 65 | fn: { |
|
66 | 66 | wiki: function() { this.singleTag('@') } |
|
67 | 67 | } |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | // spacer |
|
71 | 71 | jsToolBar.prototype.elements.space1 = {type: 'space'} |
|
72 | 72 | |
|
73 | 73 | // headings |
|
74 | 74 | jsToolBar.prototype.elements.h1 = { |
|
75 | 75 | type: 'button', |
|
76 | 76 | title: 'Heading 1', |
|
77 | 77 | fn: { |
|
78 | 78 | wiki: function() { |
|
79 | 79 | this.encloseLineSelection('h1. ', '',function(str) { |
|
80 | 80 | str = str.replace(/^h\d+\.\s+/, '') |
|
81 | 81 | return str; |
|
82 | 82 | }); |
|
83 | 83 | } |
|
84 | 84 | } |
|
85 | 85 | } |
|
86 | 86 | jsToolBar.prototype.elements.h2 = { |
|
87 | 87 | type: 'button', |
|
88 | 88 | title: 'Heading 2', |
|
89 | 89 | fn: { |
|
90 | 90 | wiki: function() { |
|
91 | 91 | this.encloseLineSelection('h2. ', '',function(str) { |
|
92 | 92 | str = str.replace(/^h\d+\.\s+/, '') |
|
93 | 93 | return str; |
|
94 | 94 | }); |
|
95 | 95 | } |
|
96 | 96 | } |
|
97 | 97 | } |
|
98 | 98 | jsToolBar.prototype.elements.h3 = { |
|
99 | 99 | type: 'button', |
|
100 | 100 | title: 'Heading 3', |
|
101 | 101 | fn: { |
|
102 | 102 | wiki: function() { |
|
103 | 103 | this.encloseLineSelection('h3. ', '',function(str) { |
|
104 | 104 | str = str.replace(/^h\d+\.\s+/, '') |
|
105 | 105 | return str; |
|
106 | 106 | }); |
|
107 | 107 | } |
|
108 | 108 | } |
|
109 | 109 | } |
|
110 | 110 | |
|
111 | 111 | // spacer |
|
112 | 112 | jsToolBar.prototype.elements.space2 = {type: 'space'} |
|
113 | 113 | |
|
114 | 114 | // ul |
|
115 | 115 | jsToolBar.prototype.elements.ul = { |
|
116 | 116 | type: 'button', |
|
117 | 117 | title: 'Unordered list', |
|
118 | 118 | fn: { |
|
119 | 119 | wiki: function() { |
|
120 | 120 | this.encloseLineSelection('','',function(str) { |
|
121 | 121 | str = str.replace(/\r/g,''); |
|
122 | 122 | return str.replace(/(\n|^)[#-]?\s*/g,"$1* "); |
|
123 | 123 | }); |
|
124 | 124 | } |
|
125 | 125 | } |
|
126 | 126 | } |
|
127 | 127 | |
|
128 | 128 | // ol |
|
129 | 129 | jsToolBar.prototype.elements.ol = { |
|
130 | 130 | type: 'button', |
|
131 | 131 | title: 'Ordered list', |
|
132 | 132 | fn: { |
|
133 | 133 | wiki: function() { |
|
134 | 134 | this.encloseLineSelection('','',function(str) { |
|
135 | 135 | str = str.replace(/\r/g,''); |
|
136 | 136 | return str.replace(/(\n|^)[*-]?\s*/g,"$1# "); |
|
137 | 137 | }); |
|
138 | 138 | } |
|
139 | 139 | } |
|
140 | 140 | } |
|
141 | 141 | |
|
142 | 142 | // spacer |
|
143 | 143 | jsToolBar.prototype.elements.space3 = {type: 'space'} |
|
144 | 144 | |
|
145 | 145 | // bq |
|
146 | 146 | jsToolBar.prototype.elements.bq = { |
|
147 | 147 | type: 'button', |
|
148 | 148 | title: 'Quote', |
|
149 | 149 | fn: { |
|
150 | 150 | wiki: function() { |
|
151 | 151 | this.encloseLineSelection('','',function(str) { |
|
152 | 152 | str = str.replace(/\r/g,''); |
|
153 | 153 | return str.replace(/(\n|^) *([^\n]*)/g,"$1> $2"); |
|
154 | 154 | }); |
|
155 | 155 | } |
|
156 | 156 | } |
|
157 | 157 | } |
|
158 | 158 | |
|
159 | 159 | // unbq |
|
160 | 160 | jsToolBar.prototype.elements.unbq = { |
|
161 | 161 | type: 'button', |
|
162 | 162 | title: 'Unquote', |
|
163 | 163 | fn: { |
|
164 | 164 | wiki: function() { |
|
165 | 165 | this.encloseLineSelection('','',function(str) { |
|
166 | 166 | str = str.replace(/\r/g,''); |
|
167 | 167 | return str.replace(/(\n|^) *[>]? *([^\n]*)/g,"$1$2"); |
|
168 | 168 | }); |
|
169 | 169 | } |
|
170 | 170 | } |
|
171 | 171 | } |
|
172 | 172 | |
|
173 | 173 | // pre |
|
174 | 174 | jsToolBar.prototype.elements.pre = { |
|
175 | 175 | type: 'button', |
|
176 | 176 | title: 'Preformatted text', |
|
177 | 177 | fn: { |
|
178 | 178 | wiki: function() { this.encloseLineSelection('<pre>\n', '\n</pre>') } |
|
179 | 179 | } |
|
180 | 180 | } |
|
181 | 181 | |
|
182 | 182 | // spacer |
|
183 | 183 | jsToolBar.prototype.elements.space4 = {type: 'space'} |
|
184 | 184 | |
|
185 | 185 | // wiki page |
|
186 | 186 | jsToolBar.prototype.elements.link = { |
|
187 | 187 | type: 'button', |
|
188 | 188 | title: 'Wiki link', |
|
189 | 189 | fn: { |
|
190 | 190 | wiki: function() { this.encloseSelection("[[", "]]") } |
|
191 | 191 | } |
|
192 | 192 | } |
|
193 | 193 | // image |
|
194 | 194 | jsToolBar.prototype.elements.img = { |
|
195 | 195 | type: 'button', |
|
196 | 196 | title: 'Image', |
|
197 | 197 | fn: { |
|
198 | 198 | wiki: function() { this.encloseSelection("!", "!") } |
|
199 | 199 | } |
|
200 | 200 | } |
|
201 | ||
|
202 | // spacer | |
|
203 | jsToolBar.prototype.elements.space5 = {type: 'space'} | |
|
204 | // help | |
|
205 | jsToolBar.prototype.elements.help = { | |
|
206 | type: 'button', | |
|
207 | title: 'Help', | |
|
208 | fn: { | |
|
209 | wiki: function() { window.open(this.help_link, '', 'resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes') } | |
|
210 | } | |
|
211 | } |
@@ -1,97 +1,100 | |||
|
1 | 1 | .jstEditor { |
|
2 | 2 | padding-left: 0px; |
|
3 | 3 | } |
|
4 | 4 | .jstEditor textarea, .jstEditor iframe { |
|
5 | 5 | margin: 0; |
|
6 | 6 | } |
|
7 | 7 | |
|
8 | 8 | .jstHandle { |
|
9 | 9 | height: 10px; |
|
10 | 10 | font-size: 0.1em; |
|
11 | 11 | cursor: s-resize; |
|
12 | 12 | /*background: transparent url(img/resizer.png) no-repeat 45% 50%;*/ |
|
13 | 13 | } |
|
14 | 14 | |
|
15 | 15 | .jstElements { |
|
16 | 16 | padding: 3px 3px 3px 0; |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | .jstElements button { |
|
20 | 20 | margin-right: 4px; |
|
21 | 21 | width : 24px; |
|
22 | 22 | height: 24px; |
|
23 | 23 | padding: 4px; |
|
24 | 24 | border-style: solid; |
|
25 | 25 | border-width: 1px; |
|
26 | 26 | border-color: #ddd; |
|
27 | 27 | background-color : #f7f7f7; |
|
28 | 28 | background-position : 50% 50%; |
|
29 | 29 | background-repeat: no-repeat; |
|
30 | 30 | } |
|
31 | 31 | .jstElements button:hover { |
|
32 | 32 | border-color: #bbb; |
|
33 | 33 | background-color: #e5e5e5; |
|
34 | 34 | } |
|
35 | 35 | .jstElements button span { |
|
36 | 36 | display : none; |
|
37 | 37 | } |
|
38 | 38 | .jstElements span { |
|
39 | 39 | display : inline; |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | .jstSpacer { |
|
43 | 43 | width : 0px; |
|
44 | 44 | font-size: 1px; |
|
45 | 45 | margin-right: 6px; |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | .jstElements .help { float: right; margin-right: 0.5em; padding-top: 8px; font-size: 0.9em; } |
|
49 | 49 | .jstElements .help a {padding: 2px 0 2px 20px; background: url(../images/help.png) no-repeat 0 50%;} |
|
50 | 50 | |
|
51 | 51 | /* Buttons |
|
52 | 52 | -------------------------------------------------------- */ |
|
53 | 53 | .jstb_strong { |
|
54 | 54 | background-image: url(../images/jstoolbar/bt_strong.png); |
|
55 | 55 | } |
|
56 | 56 | .jstb_em { |
|
57 | 57 | background-image: url(../images/jstoolbar/bt_em.png); |
|
58 | 58 | } |
|
59 | 59 | .jstb_ins { |
|
60 | 60 | background-image: url(../images/jstoolbar/bt_ins.png); |
|
61 | 61 | } |
|
62 | 62 | .jstb_del { |
|
63 | 63 | background-image: url(../images/jstoolbar/bt_del.png); |
|
64 | 64 | } |
|
65 | 65 | .jstb_code { |
|
66 | 66 | background-image: url(../images/jstoolbar/bt_code.png); |
|
67 | 67 | } |
|
68 | 68 | .jstb_h1 { |
|
69 | 69 | background-image: url(../images/jstoolbar/bt_h1.png); |
|
70 | 70 | } |
|
71 | 71 | .jstb_h2 { |
|
72 | 72 | background-image: url(../images/jstoolbar/bt_h2.png); |
|
73 | 73 | } |
|
74 | 74 | .jstb_h3 { |
|
75 | 75 | background-image: url(../images/jstoolbar/bt_h3.png); |
|
76 | 76 | } |
|
77 | 77 | .jstb_ul { |
|
78 | 78 | background-image: url(../images/jstoolbar/bt_ul.png); |
|
79 | 79 | } |
|
80 | 80 | .jstb_ol { |
|
81 | 81 | background-image: url(../images/jstoolbar/bt_ol.png); |
|
82 | 82 | } |
|
83 | 83 | .jstb_bq { |
|
84 | 84 | background-image: url(../images/jstoolbar/bt_bq.png); |
|
85 | 85 | } |
|
86 | 86 | .jstb_unbq { |
|
87 | 87 | background-image: url(../images/jstoolbar/bt_bq_remove.png); |
|
88 | 88 | } |
|
89 | 89 | .jstb_pre { |
|
90 | 90 | background-image: url(../images/jstoolbar/bt_pre.png); |
|
91 | 91 | } |
|
92 | 92 | .jstb_link { |
|
93 | 93 | background-image: url(../images/jstoolbar/bt_link.png); |
|
94 | 94 | } |
|
95 | 95 | .jstb_img { |
|
96 | 96 | background-image: url(../images/jstoolbar/bt_img.png); |
|
97 | 97 | } |
|
98 | .jstb_help { | |
|
99 | background-image: url(../images/help.png); | |
|
100 | } |
General Comments 0
You need to be logged in to leave comments.
Login now