diff --git a/templates/framework/js/vendor/markitup/jquery.markitup.js b/templates/framework/js/vendor/markitup/jquery.markitup.js index 85ae3aa6..b7e2d039 100644 --- a/templates/framework/js/vendor/markitup/jquery.markitup.js +++ b/templates/framework/js/vendor/markitup/jquery.markitup.js @@ -1,9 +1,9 @@ // ---------------------------------------------------------------------------- // markItUp! Universal MarkUp Engine, JQuery plugin -// v 1.1.12 +// v 1.1.x // Dual licensed under the MIT and GPL licenses. // ---------------------------------------------------------------------------- -// Copyright (C) 2007-2011 Jay Salvat +// Copyright (C) 2007-2012 Jay Salvat // http://markitup.jaysalvat.com/ // ---------------------------------------------------------------------------- // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -26,13 +26,19 @@ // ---------------------------------------------------------------------------- (function($) { $.fn.markItUp = function(settings, extraSettings) { - var options, ctrlKey, shiftKey, altKey; - ctrlKey = shiftKey = altKey = false; - + var method, params, options, ctrlKey, shiftKey, altKey; ctrlKey = shiftKey = altKey = false; + + if (typeof settings == 'string') { + method = settings; + params = extraSettings; + } + options = { id: '', nameSpace: '', root: '', + previewHandler: false, previewInWindow: '', // 'width=800, height=600, resizable=yes, scrollbars=yes' + previewInElement: '', previewAutoRefresh: true, previewPosition: 'after', previewTemplatePath: '~/templates/preview.html', @@ -60,6 +66,35 @@ }); } + // Quick patch to keep compatibility with jQuery 1.9 + var uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + var matched = uaMatch( navigator.userAgent ); + var browser = {}; + + if (matched.browser) { + browser[matched.browser] = true; + browser.version = matched.version; + } + if (browser.chrome) { + browser.webkit = true; + } else if (browser.webkit) { + browser.safari = true; + } + return this.each(function() { var $$, textarea, levels, scrollPosition, caretPosition, caretOffset, clicked, hash, header, footer, previewWindow, template, iFrame, abort; @@ -73,6 +108,20 @@ options.previewParserPath = localize(options.previewParserPath); options.previewTemplatePath = localize(options.previewTemplatePath); + if (method) { + switch(method) { + case 'remove': + remove(); + break; + case 'insert': + markup(params); + break; + default: + $.error('Method ' + method + ' does not exist on jQuery.markItUp'); + } + return; + } + // apply the computed path to ~/ function localize(data, inText) { if (inText) { @@ -106,29 +155,29 @@ footer = $('
').insertAfter($$); // add the resize handle after textarea - if (options.resizeHandle === true && $.browser.safari !== true) { + if (options.resizeHandle === true && browser.safari !== true) { resizeHandle = $('
') .insertAfter($$) - .bind("mousedown", function(e) { + .bind("mousedown.markItUp", function(e) { var h = $$.height(), y = e.clientY, mouseMove, mouseUp; mouseMove = function(e) { $$.css("height", Math.max(20, e.clientY+h-y)+"px"); return false; }; mouseUp = function(e) { - $("html").unbind("mousemove", mouseMove).unbind("mouseup", mouseUp); + $("html").unbind("mousemove.markItUp", mouseMove).unbind("mouseup.markItUp", mouseUp); return false; }; - $("html").bind("mousemove", mouseMove).bind("mouseup", mouseUp); + $("html").bind("mousemove.markItUp", mouseMove).bind("mouseup.markItUp", mouseUp); }); footer.append(resizeHandle); } // listen key events - $$.keydown(keyPressed).keyup(keyPressed); + $$.bind('keydown.markItUp', keyPressed).bind('keyup', keyPressed); // bind an event to catch external calls - $$.bind("insertion", function(e, settings) { + $$.bind("insertion.markItUp", function(e, settings) { if (settings.target !== false) { get(); } @@ -138,9 +187,13 @@ }); // remember the last focus - $$.focus(function() { + $$.bind('focus.markItUp', function() { $.markItUp.focused = this; }); + + if (options.previewInElement) { + refreshPreview(); + } } // recursively build header with dropMenus from markupset @@ -159,28 +212,27 @@ t += levels[j]+"-"; } li = $('
  • '+(button.name||'')+'
  • ') - .bind("contextmenu", function() { // prevent contextmenu on mac and allow ctrl+click + .bind("contextmenu.markItUp", function() { // prevent contextmenu on mac and allow ctrl+click return false; - }).click(function() { - return false; - }).bind("focusin", function(){ - //$$.focus(); - }).mouseup(function() { + }).bind('click.markItUp', function(e) { + e.preventDefault(); + }).bind("focusin.markItUp", function(){ + $$.focus(); + }).bind('mouseup', function() { if (button.call) { eval(button.call)(); } setTimeout(function() { markup(button) },1); return false; - }).hover(function() { + }).bind('mouseenter.markItUp', function() { $('> ul', this).show(); $(document).one('click', function() { // close dropmenu if click outside $('ul ul', header).hide(); } ); - }, function() { + }).bind('mouseleave.markItUp', function() { $('> ul', this).hide(); - } - ).appendTo(ul); + }).appendTo(ul); if (button.dropMenu) { levels.push(i); $(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu)); @@ -248,13 +300,14 @@ block = openWith + placeHolder + closeWith; } else { string = string || selection; - + var lines = [string], blocks = []; - if (multiline===true) { + + if (multiline === true) { lines = string.split(/\r?\n/); } - for (var l=0; l < lines.length; l++) { + for (var l = 0; l < lines.length; l++) { line = lines[l]; var trailingSpaces; if (trailingSpaces = line.match(/ *$/)) { @@ -270,10 +323,12 @@ block = openBlockWith + block + closeBlockWith; return { block:block, + openBlockWith:openBlockWith, openWith:openWith, replaceWith:replaceWith, placeHolder:placeHolder, - closeWith:closeWith + closeWith:closeWith, + closeBlockWith:closeBlockWith }; } @@ -286,7 +341,6 @@ root:options.root, textarea:textarea, selection:(selection||''), - selectionOuter:(selectionOuter||''), caretPosition:caretPosition, ctrlKey:ctrlKey, shiftKey:shiftKey, @@ -311,9 +365,10 @@ lines[i] = ""; } } + string = { block:lines.join('\n')}; start = caretPosition; - len = string.block.length + (($.browser.opera) ? n-1 : 0); + len = string.block.length + ((browser.opera) ? n-1 : 0); } else if (ctrlKey === true) { string = build(selection); start = caretPosition + string.openWith.length; @@ -334,8 +389,8 @@ if ((selection === '' && string.replaceWith === '')) { caretOffset += fixOperaBug(string.block); - start = caretPosition + string.openWith.length; - len = string.block.length - string.openWith.length - string.closeWith.length; + start = caretPosition + string.openBlockWith.length + string.openWith.length; + len = string.block.length - string.openBlockWith.length - string.openWith.length - string.closeWith.length - string.closeBlockWith.length; caretOffset = $$.val().substring(caretPosition, $$.val().length).length; caretOffset -= fixOperaBug($$.val().substring(0, caretPosition)); @@ -370,14 +425,14 @@ // Substract linefeed in Opera function fixOperaBug(string) { - if ($.browser.opera) { + if (browser.opera) { return string.length - string.replace(/\n*/g, '').length; } return 0; } // Substract linefeed in IE function fixIeBug(string) { - if ($.browser.msie) { + if (browser.msie) { return string.length - string.replace(/\r*/g, '').length; } return 0; @@ -397,7 +452,7 @@ function set(start, len) { if (textarea.createTextRange){ // quick fix to make it work on Opera 9.5 - if ($.browser.opera && $.browser.version >= 9.5 && len == 0) { + if (browser.opera && browser.version >= 9.5 && len == 0) { return false; } range = textarea.createTextRange(); @@ -414,25 +469,12 @@ // get the selection function get() { - // get the selection by outer text - selectionOuter = ''; - if(window.getSelection){ - selectionOuter = window.getSelection().toString(); - } else if(window.document.selection){ - var sel = window.document.selection.createRange(); - selectionOuter = sel.text || sel; - if(selectionOuter.toString) { - selectionOuter = selectionOuter.toString(); - } else { - selectionOuter=''; - } - } textarea.focus(); scrollPosition = textarea.scrollTop; if (document.selection) { selection = document.selection.createRange().text; - if ($.browser.msie) { // ie + if (browser.msie) { // ie var range = document.selection.createRange(), rangeCopy = range.duplicate(); rangeCopy.moveToElementText(textarea); caretPosition = -1; @@ -453,7 +495,11 @@ // open preview window function preview() { - if (!previewWindow || previewWindow.closed) { + if (typeof options.previewHandler === 'function') { + previewWindow = true; + } else if (options.previewInElement) { + previewWindow = $(options.previewInElement); + } else if (!previewWindow || previewWindow.closed) { if (options.previewInWindow) { previewWindow = window.open('', 'preview', options.previewInWindow); $(window).unload(function() { @@ -489,11 +535,13 @@ renderPreview(); } - function renderPreview() { + function renderPreview() { var phtml; - if (options.previewParser && typeof options.previewParser === 'function') { + if (options.previewHandler && typeof options.previewHandler === 'function') { + options.previewHandler( $$.val() ); + } else if (options.previewParser && typeof options.previewParser === 'function') { var data = options.previewParser( $$.val() ); - writeInPreview( localize(data, 1) ); + writeInPreview(localize(data, 1) ); } else if (options.previewParserPath !== '') { $.ajax({ type: 'POST', @@ -521,7 +569,9 @@ } function writeInPreview(data) { - if (previewWindow.document) { + if (options.previewInElement) { + $(options.previewInElement).html(data); + } else if (previewWindow && previewWindow.document) { try { sp = previewWindow.document.documentElement.scrollTop } catch(e) { @@ -542,7 +592,7 @@ if (e.type === 'keydown') { if (ctrlKey === true) { - li = $('a[accesskey="'+String.fromCharCode(e.keyCode)+'"]', header).parent('li'); + li = $('a[accesskey="'+((e.keyCode == 13) ? '\\n' : String.fromCharCode(e.keyCode))+'"]', header).parent('li'); if (li.length !== 0) { ctrlKey = false; setTimeout(function() { @@ -583,14 +633,19 @@ } } + function remove() { + $$.unbind(".markItUp").removeClass('markItUpEditor'); + $$.parent('div').parent('div.markItUp').parent('div').replaceWith($$); + $$.data('markItUp', null); + } + init(); }); }; $.fn.markItUpRemove = function() { return this.each(function() { - var $$ = $(this).unbind().removeClass('markItUpEditor'); - $$.parent('div').parent('div.markItUp').parent('div').replaceWith($$); + $(this).markItUp('remove'); } ); }; diff --git a/templates/framework/js/vendor/markitup/sets/default/images/list-bullet.png b/templates/framework/js/vendor/markitup/sets/default/images/list-bullet.png new file mode 100644 index 00000000..4a8672bd Binary files /dev/null and b/templates/framework/js/vendor/markitup/sets/default/images/list-bullet.png differ diff --git a/templates/framework/js/vendor/markitup/sets/default/images/list-numeric.png b/templates/framework/js/vendor/markitup/sets/default/images/list-numeric.png new file mode 100644 index 00000000..33b0b8df Binary files /dev/null and b/templates/framework/js/vendor/markitup/sets/default/images/list-numeric.png differ diff --git a/templates/framework/js/vendor/markitup/sets/default/set.js b/templates/framework/js/vendor/markitup/sets/default/set.js new file mode 100644 index 00000000..b7fdf818 --- /dev/null +++ b/templates/framework/js/vendor/markitup/sets/default/set.js @@ -0,0 +1,30 @@ +// ---------------------------------------------------------------------------- +// markItUp! +// ---------------------------------------------------------------------------- +// Copyright (C) 2011 Jay Salvat +// http://markitup.jaysalvat.com/ +// ---------------------------------------------------------------------------- +// Html tags +// http://en.wikipedia.org/wiki/html +// ---------------------------------------------------------------------------- +// Basic set. Feel free to add more tags +// ---------------------------------------------------------------------------- +var mySettings = { + onShiftEnter: {keepDefault:false, replaceWith:'
    \n'}, + onCtrlEnter: {keepDefault:false, openWith:'\n

    ', closeWith:'

    '}, + onTab: {keepDefault:false, replaceWith:' '}, + markupSet: [ + {name:'Bold', key:'B', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, + {name:'Italic', key:'I', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, + {name:'Stroke through', key:'S', openWith:'', closeWith:'' }, + {separator:'---------------' }, + {name:'Bulleted List', openWith:'
  • ', closeWith:'
  • ', multiline:true, openBlockWith:''}, + {name:'Numeric List', openWith:'
  • ', closeWith:'
  • ', multiline:true, openBlockWith:'
      \n', closeBlockWith:'\n
    '}, + {separator:'---------------' }, + {name:'Picture', key:'P', replaceWith:'[![Alternative text]!]' }, + {name:'Link', key:'L', openWith:'', closeWith:'', placeHolder:'Your text to link...' }, + {separator:'---------------' }, + {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }, + {name:'Preview', className:'preview', call:'preview'} + ] +} diff --git a/templates/framework/js/vendor/markitup/sets/default/style.css b/templates/framework/js/vendor/markitup/sets/default/style.css index f9bccdba..336b60eb 100644 --- a/templates/framework/js/vendor/markitup/sets/default/style.css +++ b/templates/framework/js/vendor/markitup/sets/default/style.css @@ -2,25 +2,33 @@ // markItUp! // By Jay Salvat - http://markitup.jaysalvat.com/ // ------------------------------------------------------------------*/ -.markItUp .editor-h4 a { background-image:url(images/h4.png); } -.markItUp .editor-h5 a { background-image:url(images/h5.png); } -.markItUp .editor-h6 a { background-image:url(images/h6.png); } -.markItUp .editor-bold a { background-image:url(images/bold.png); } -.markItUp .editor-italic a { background-image:url(images/italic.png); } -.markItUp .editor-stroke a { background-image:url(images/stroke.png); } -.markItUp .editor-underline a { background-image:url(images/underline.png); } -.markItUp .editor-quote a { background-image:url(images/quote.png); } -.markItUp .editor-code a { background-image:url(images/code.png); } -.markItUp .editor-ul a { background-image:url(images/ul.png); } -.markItUp .editor-ol a { background-image:url(images/ol.png); } -.markItUp .editor-li a { background-image:url(images/li.png); } +.markItUp .markItUpButton1 a { + background-image:url(images/bold.png); +} +.markItUp .markItUpButton2 a { + background-image:url(images/italic.png); +} +.markItUp .markItUpButton3 a { + background-image:url(images/stroke.png); +} -.markItUp .editor-picture a { background-image:url(images/picture.png); } -.markItUp .editor-image a { background-image:url(images/image.png); } -.markItUp .editor-link a { background-image:url(images/link.png); } +.markItUp .markItUpButton4 a { + background-image:url(images/list-bullet.png); +} +.markItUp .markItUpButton5 a { + background-image:url(images/list-numeric.png); +} -.markItUp .editor-clean a { background-image:url(images/clean.png); } -.markItUp .editor-preview a { background-image:url(images/preview.png); } -.markItUp .editor-cut a { background-image:url(images/cut.png); } -.markItUp .editor-video a { background-image:url(images/video.png); } -.markItUp .editor-user a { background-image:url(images/user.png); } \ No newline at end of file +.markItUp .markItUpButton6 a { + background-image:url(images/picture.png); +} +.markItUp .markItUpButton7 a { + background-image:url(images/link.png); +} + +.markItUp .markItUpButton8 a { + background-image:url(images/clean.png); +} +.markItUp .preview a { + background-image:url(images/preview.png); +} diff --git a/templates/framework/js/vendor/markitup/skins/markitup/style.css b/templates/framework/js/vendor/markitup/skins/markitup/style.css index e2109d6e..c11c2ea2 100644 --- a/templates/framework/js/vendor/markitup/skins/markitup/style.css +++ b/templates/framework/js/vendor/markitup/skins/markitup/style.css @@ -144,19 +144,4 @@ .wiki .markItUpEditor, .dotclear .markItUpEditor { background-image:url(images/bg-editor-wiki.png); -} - - - - - - - - - - - - - - - +} \ No newline at end of file diff --git a/templates/framework/js/vendor/markitup/skins/simple/style.css b/templates/framework/js/vendor/markitup/skins/simple/style.css index 07027dcb..fe3753c0 100644 --- a/templates/framework/js/vendor/markitup/skins/simple/style.css +++ b/templates/framework/js/vendor/markitup/skins/simple/style.css @@ -1,131 +1,118 @@ /* ------------------------------------------------------------------- // markItUp! Universal MarkUp Engine, JQuery plugin -// By Jay Salvat - http: //markitup.jaysalvat.com/ +// By Jay Salvat - http://markitup.jaysalvat.com/ // ------------------------------------------------------------------*/ -.markItUp a: link, -.markItUp a: visited { color: #000; text-decoration: none; } -.markItUp { margin-bottom: 5px; } -.markItUpContainer { font: 11px Verdana, Arial, Helvetica, sans-serif; } +.markItUp * { + margin:0px; padding:0px; + outline:none; +} +.markItUp a:link, +.markItUp a:visited { + color:#000; + text-decoration:none; +} +.markItUp { + width:700px; + margin:5px 0 5px 0; +} +.markItUpContainer { + font:11px Verdana, Arial, Helvetica, sans-serif; +} .markItUpEditor { - font: 12px "Courier New", Courier, monospace; - padding: 5px; - height: 200px; - line-height: 18px; - overflow: auto; - width: 100%; - -moz-box-sizing: border-box; - box-sizing: border-box; - border: 1px solid #C0CAD5; + font:12px 'Courier New', Courier, monospace; + padding:5px; + width:690px; + height:320px; + clear:both; + line-height:18px; + overflow:auto; } .markItUpPreviewFrame { - overflow: auto; - background-color: #FFF; - border: 1px solid #eee; - padding: 10px; - height: 300px; - margin: 5px 0; - font: 12px Tahoma, Arial, Helvetica, sans-serif; + overflow:auto; + background-color:#FFF; + width:99.9%; + height:300px; + margin:5px 0; +} +.markItUpFooter { + width:100%; } -.markItUpFooter { width: 100%; } .markItUpResizeHandle { - overflow: hidden; - height: 8px; - background: url(images/handle.png) 50% 3px no-repeat; - cursor: n-resize; + overflow:hidden; + width:22px; height:5px; + margin-left:auto; + margin-right:auto; + background-image:url(images/handle.png); + cursor:n-resize; } - - /***************************************************************************************/ /* first row of buttons */ -.markItUpHeader { - background: #eee; - padding: 5px; - border-top: 1px solid #c0cad5; - border-left: 1px solid #c0cad5; - border-right: 1px solid #c0cad5; +.markItUpHeader ul li { + list-style:none; + float:left; + position:relative; } -.markItUpHeader ul { - overflow: visible; - zoom: 1; - display: inline-block; - *display: inline; /* ie <= 7 */ +.markItUpHeader ul li:hover > ul{ + display:block; } -.markItUpHeader ul li { list-style: none; float: left; position: relative; margin-right: 6px; } -.markItUpHeader ul li: hover > ul{ display: block; } .markItUpHeader ul .markItUpDropMenu { - background: transparent url(images/menu.png) no-repeat 115% 50%; - margin-right: 5px; + background:transparent url(images/menu.png) no-repeat 115% 50%; + margin-right:5px; } .markItUpHeader ul .markItUpDropMenu li { - margin-right: 0px; + margin-right:0px; } /* next rows of buttons */ .markItUpHeader ul ul { - display: none; - position: absolute; - top: 16px; left: 0px; - background: #eee; - border: 1px solid #000; + display:none; + position:absolute; + top:18px; left:0px; + background:#FFF; + border:1px solid #000; } .markItUpHeader ul ul li { - float: none; - border-bottom: 1px solid #000; + float:none; + border-bottom:1px solid #000; } .markItUpHeader ul ul .markItUpDropMenu { - background: #eee url(images/submenu.png) no-repeat 100% 50%; + background:#FFF url(images/submenu.png) no-repeat 100% 50%; } .markItUpHeader ul .markItUpSeparator { - margin: 0 6px 0 0; - width: 1px; - height: 16px; - overflow: hidden; - background-color: #CCC; + margin:0 10px; + width:1px; + height:16px; + overflow:hidden; + background-color:#CCC; } .markItUpHeader ul ul .markItUpSeparator { - width: auto; height: 1px; - margin: 0px; + width:auto; height:1px; + margin:0px; } /* next rows of buttons */ .markItUpHeader ul ul ul { - position: absolute; - top: -1px; left: 150px; + position:absolute; + top:-1px; left:150px; } .markItUpHeader ul ul ul li { - float: none; + float:none; } .markItUpHeader ul a { - display: block; - width: 16px; height: 16px; - text-indent: -10000px; - background-repeat: no-repeat; - margin: 0px; + display:block; + width:16px; height:16px; + text-indent:-10000px; + background-repeat:no-repeat; + padding:3px; + margin:0px; } .markItUpHeader ul ul a { - display: block; - padding-left: 0px; - text-indent: 0; - width: 120px; - padding: 5px 5px 5px 25px; - background-position: 2px 50%; - color: #000; - text-decoration: none; - white-space: nowrap; - overflow: hidden; - text-overflow:ellipsis; + display:block; + padding-left:0px; + text-indent:0; + width:120px; + padding:5px 5px 5px 25px; + background-position:2px 50%; } .markItUpHeader ul ul a:hover { - background-color: #fff; + color:#FFF; + background-color:#000; } - - - - - -.markItUpPreviewFrame { } -.markItUpPreviewFrame p { margin-bottom: 18px; } -.markItUpPreviewFrame blockquote { background: #fafafa; padding: 10px 15px; color: #555; margin-bottom: 5px; clear: both; } -.markItUpPreviewFrame pre { background: #fafafa; border: 1px solid #dce6f0; margin-bottom: 10px; overflow: auto; padding: 5px 10px; } -.markItUpPreviewFrame ul { list-style-type: disc; margin-left: 17px; } -.markItUpPreviewFrame ol { list-style-type: decimal; margin-left: 22px; } -.markItUpPreviewFrame img[align="right"] { margin: 4px 0 5px 15px; } -.markItUpPreviewFrame img[align="left"] { margin: 4px 15px 10px 0; }