diff --git a/config.inc.php b/config.inc.php index 6642930..79d07bc 100644 --- a/config.inc.php +++ b/config.inc.php @@ -11,52 +11,52 @@ // AddOn-MARKITUP - ////////////////////////////////////////////////////////////////////////////////// - // CONFIG - ////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////// + // CONFIG + ////////////////////////////////////////////////////////////////////////////////// - // VARs - $addon_name = "gs_markitup"; + // VARs + $addon_name = "gs_markitup"; - // Sprachdateien anhaengen - if(TRUE == $REX['REDAXO']) - { - $I18N->appendFile($REX['INCLUDE_PATH'].'/addons/'.$addon_name.'/lang/'); - } - - $REX['ADDON']['rxid'][$addon_name] = '711'; - $REX['ADDON']['page'][$addon_name] = "markitup"; - - if(TRUE == $REX['REDAXO']) - { - $REX['ADDON']['name'][$addon_name] = $I18N->msg("addon_name"); - } - - // Recht um das AddOn zu aendern - $REX['ADDON']['perm'][$addon_name] = 'markitup[1]'; - - // Credits - $REX['ADDON']['version'][$addon_name] = '1.1.12'; - $REX['ADDON']['author'][$addon_name] = 'Gilbert Seilheimer'; - $REX['ADDON']['supportpage'][$addon_name] = 'forum.redaxo.org'; - - // ************* - $REX['PERM'][] = 'markitup[1]'; - $REX['PERM'][] = 'markitup[2]'; - - // Fuer die Benutzervewaltung - $REX['EXTPERM'][] = 'markitup[3]'; + // Sprachdateien anhaengen + if(TRUE == $REX['REDAXO']) + { + $I18N->appendFile($REX['INCLUDE_PATH'].'/addons/'.$addon_name.'/lang/'); + } + + $REX['ADDON']['rxid'][$addon_name] = '711'; + $REX['ADDON']['page'][$addon_name] = "markitup"; + + if(TRUE == $REX['REDAXO']) + { + $REX['ADDON']['name'][$addon_name] = $I18N->msg("addon_name"); + } + + // Recht um das AddOn zu aendern + $REX['ADDON']['perm'][$addon_name] = 'markitup[1]'; + + // Credits + $REX['ADDON']['version'][$addon_name] = '1.1.12'; + $REX['ADDON']['author'][$addon_name] = 'Gilbert Seilheimer'; + $REX['ADDON']['supportpage'][$addon_name] = 'forum.redaxo.org'; + + // ************* + $REX['PERM'][] = 'markitup[1]'; + $REX['PERM'][] = 'markitup[2]'; + + // Fuer die Benutzervewaltung + $REX['EXTPERM'][] = 'markitup[3]'; - ////////////////////////////////////////////////////////////////////////////////// - // SUBPAGES - ////////////////////////////////////////////////////////////////////////////////// - - if(TRUE == $REX['REDAXO']) - { - $REX['ADDON'][$addon_name]['SUBPAGES'] = - array( - array('readme', $I18N->msg('addon_subpage_readme')), - array('modul', $I18N->msg('addon_subpage_modul')) - ); - } + ////////////////////////////////////////////////////////////////////////////////// + // SUBPAGES + ////////////////////////////////////////////////////////////////////////////////// + + if(TRUE == $REX['REDAXO']) + { + $REX['ADDON'][$addon_name]['SUBPAGES'] = + array( + array('readme', $I18N->msg('addon_subpage_readme')), + array('modul', $I18N->msg('addon_subpage_modul')) + ); + } ?> \ No newline at end of file diff --git a/files/jquery.autogrow-textarea.js b/files/jquery.autogrow-textarea.js new file mode 100644 index 0000000..1418576 --- /dev/null +++ b/files/jquery.autogrow-textarea.js @@ -0,0 +1,42 @@ +(function($) { + /* + * Auto-growing textareas; technique ripped from Facebook + */ + $.fn.autogrow = function(options) { + + this.filter('textarea').each(function() { + + var $this = $(this), + minHeight = $this.height(), + lineHeight = $this.css('lineHeight'); + var shadow = $('
').css({ + position: 'absolute', + top: -10000, + left: -10000, + width: $(this).width() - parseInt($this.css('paddingLeft')) - parseInt($this.css('paddingRight')), + fontSize: $this.css('fontSize'), + fontFamily: $this.css('fontFamily'), + lineHeight: $this.css('lineHeight'), + resize: 'none' + }).appendTo(document.body); + var update = function() { + var times = function(string, number) { + for (var i = 0, r = ''; i < number; i ++) r += string; + return r; + }; + var val = this.value.replace(//g, '>') + .replace(/&/g, '&') + .replace(/\n$/, '
 ') + .replace(/\n/g, '
') + .replace(/ {2,}/g, function(space) { return times(' ', space.length -1) + ' ' }); + shadow.html(val); + $(this).css('height', Math.max(shadow.height() + 20, minHeight)); + } + $(this).change(update).keyup(update).keydown(update); + update.apply(this); + }); + return this; + } + +})(jQuery); \ No newline at end of file diff --git a/files/jquery.markitup.js b/files/jquery.markitup.js index 10add9d..3d777a2 100644 --- a/files/jquery.markitup.js +++ b/files/jquery.markitup.js @@ -1,4 +1,4 @@ -// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // markItUp! Universal MarkUp Engine, JQuery plugin // v 1.1.x // Dual licensed under the MIT and GPL licenses. diff --git a/files/readme.txt b/files/readme.txt new file mode 100644 index 0000000..dfbb656 --- /dev/null +++ b/files/readme.txt @@ -0,0 +1,55 @@ +markItUp! 1.1.3 + +CHANGE LOG +markItUp! 1.1.3 2008-09-12 +- Fixed: IE7 preview problem + +markItUp! 1.1.2 2008-07-17 +- Fixed: Quick fix for Opera 9.5 caret position problem after insertion + +markItUp! 1.1.1 2008-06-02 +- Fixed: Key events status are passed to callbacks properly +- Improved: ScrollPosition is kept in the preview when its refreshed + +markItUp! 1.1.0 2008-05-04 +- Modified: Textarea's id is no more moved to the main container +- Modified: NameSpace Span become a Div to remain strict +- Added: Relative path to the script is computed +- Added: Relative path to the script passed to callbacks +- Added: Global instance ID property +- Added: $(element).markItUpRemove() to remove markItUp! +- Added: Resize handle is now optional with resizeHandle property +- Added: Property previewInWindow is added and accept window parameter +- Added: Property previewPosition is added +- Modified: Resize handle is no more displayed in Safari to avoid repetition with the native handle +- Modified: Property previewIframeRefresh become previewAutorefresh +- Modified: Built-in Html Preview call a template file +- Improved: Autorefreshing is now apply for preview in window too +- Improved: Cancel button in prompt window cancel now the whole insertion process +- Improved: Cleaner markItUp! code added to the DOM +- Removed: Depreciated preview properties as previewBaseUrl, previewCharset, previewCssPath, previewBodyId, previewBodyClassName +- Removed: Property previewIframe not longer exists +- Fixed: "Magic markups" works with line feeds +- Fixed: Key events are initialized after insertion +- Fixed: Internet Explorer line feed offset bug +- Fixed: Shortcut keys on Mac OS +- Fixed: Ctrl+click works and doesn't open Mac context menu anymore +- Fixed: Ctrl+click works and doesn't open the page in a new tab anymore +- Fixed: Minor Css modifications + +markItUp! 1.0.3 2008-04-04 +- Fixed: IE7 Preview empty baseurl problem +- Fixed: IE7 external targeted insertion +- Added: Property scrollPosition is passed to callbacks functions + +markItUp! 1.0.2 2008-03-31 +- Fixed: IE7 Html preview problems +- Fixed: Selection is kept if nothing is inserted +- Improved: Code minified + +markItUp! 1.0.1 2008-03-21 +- Removed: Global PlaceHolder +- Modified: Property previewCharset is setted to "utf-8" by default + +markItUp! 1.0.0 2008-03-01 +- First public release diff --git a/files/sets/images/align-center.png b/files/sets/images/align-center.png new file mode 100644 index 0000000..57beb38 Binary files /dev/null and b/files/sets/images/align-center.png differ diff --git a/files/sets/images/align-justify.png b/files/sets/images/align-justify.png new file mode 100644 index 0000000..2fbdd69 Binary files /dev/null and b/files/sets/images/align-justify.png differ diff --git a/files/sets/images/align-left.png b/files/sets/images/align-left.png new file mode 100644 index 0000000..6c8fcc1 Binary files /dev/null and b/files/sets/images/align-left.png differ diff --git a/files/sets/images/align-right.png b/files/sets/images/align-right.png new file mode 100644 index 0000000..a150257 Binary files /dev/null and b/files/sets/images/align-right.png differ diff --git a/files/sets/images/blockquote.png b/files/sets/images/blockquote.png new file mode 100644 index 0000000..e54ebeb Binary files /dev/null and b/files/sets/images/blockquote.png differ diff --git a/files/sets/images/image.png b/files/sets/images/image.png index fc3c393..4a158fe 100644 Binary files a/files/sets/images/image.png and b/files/sets/images/image.png differ diff --git a/files/sets/images/link-media.png b/files/sets/images/link-media.png index 4a158fe..780f7d6 100644 Binary files a/files/sets/images/link-media.png and b/files/sets/images/link-media.png differ diff --git a/files/sets/images/separator.png b/files/sets/images/separator.png new file mode 100644 index 0000000..5925a6a Binary files /dev/null and b/files/sets/images/separator.png differ diff --git a/files/sets/images/video.png b/files/sets/images/video.png new file mode 100644 index 0000000..fc3c393 Binary files /dev/null and b/files/sets/images/video.png differ diff --git a/files/sets/set.js b/files/sets/set.js index fed1a97..74f90b4 100644 --- a/files/sets/set.js +++ b/files/sets/set.js @@ -1,4 +1,4 @@ -// ------------------------------------------------------------------- +// ------------------------------------------------------------------- // markItUp! // ------------------------------------------------------------------- // Copyright (C) 2008 Jay Salvat @@ -14,99 +14,119 @@ function insertImage(src,desc) { img = src.replace(/files\//, ""); - // jQuery.markItUp({replaceWith:"!./"+ src +"!"}); //jQuery.markItUp({ replaceWith:"!index.php?rex_resize=[![Image Width]!]w__"+ img +"!"}); jQuery.markItUp({ replaceWith:'!{float: [![Align left|right]!]; padding: 0.5em 1em;}index.php?rex_img_type=fancybox_resize_200&rex_img_file='+ img +'('+desc+')!'}); } +function insertVideo(src,desc) +{ + video = src.replace(/files\//, ""); + //jQuery.markItUp({ replaceWith:"!index.php?rex_resize=[![Image Width]!]w__"+ video +"!"}); + jQuery.markItUp({ replaceWith:'!{float: [![Align left|right]!]; padding: 0.5em 1em;}index.php?rex_img_type=fancybox_resize_200&rex_img_file='+ video +'('+desc+')!'}); +} function insertFileLink(file) { - jQuery.markItUp({openWith:'"', closeWith:'":'+file, placeHolder:'Ihr Text zum LINK hier...'}); + jQuery.markItUp({openWith:'"', closeWith:'":'+file, placeHolder:'Ihr Text zum LINK hier...'}); } function insertLink(url,desc) { - jQuery.markItUp({openWith:'"(!((fancyboxStyleInline-3 iframe))!)'+desc, closeWith:'":'+url}); + jQuery.markItUp({openWith:'"(!((fancyboxStyleInline-3 iframe))!)'+desc, closeWith:'":'+url}); } function markitup_getURLParam(strParamName) { - var strReturn = ""; - var strHref = window.location.href; - if ( strHref.indexOf("?") > -1 ) - { - var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); - var aQueryString = strQueryString.split("&"); - for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) - { - if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ) - { - var aParam = aQueryString[iParam].split("="); - strReturn = aParam[1]; - break; - } - } - } - return unescape(strReturn); + var strReturn = ""; + var strHref = window.location.href; + if ( strHref.indexOf("?") > -1 ) + { + var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); + var aQueryString = strQueryString.split("&"); + for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) + { + if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ) + { + var aParam = aQueryString[iParam].split("="); + strReturn = aParam[1]; + break; + } + } + } + return unescape(strReturn); } mySettings = { - previewParserPath: '', // path to your Textile parser - onShiftEnter: {keepDefault:false, replaceWith:'
\n'}, - markupSet: - [ - {name:'Heading 1', className:'h1', key:'1', openWith:'\nh1(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, - {name:'Heading 2', className:'h2', key:'2', openWith:'\nh2(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, - {name:'Heading 3', className:'h3', key:'3', openWith:'\nh3(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, - {name:'Heading 4', className:'h4', key:'4', openWith:'\nh4(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, - {name:'Heading 5', className:'h5', key:'5', openWith:'\nh5(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, - {name:'Heading 6', className:'h6', key:'6', openWith:'\nh6(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, - {separator:'---------------'}, - {name:'Bold', key:'B', className:'bold', closeWith:'*', openWith:'*'}, - {name:'Italic', key:'I', className:'italic', closeWith:'_', openWith:'_'}, - {name:'Stroke through', key:'S', className:'stroke', closeWith:'-', openWith:'-'}, - {separator:'---------------'}, - {name:'Bulleted list', className:'list-bullet', openWith:'(!(* |!|*)!)'}, - {name:'Numeric list', className:'list-numeric', openWith:'(!(# |!|#)!)'}, - {separator:'---------------'}, - {name:'Image', className:'image', - beforeInsert:function(h) { - openMediaPool('TINYIMG'); - } - }, - {separator:'---------------'}, - {name:'Link intern', className:'link-intern', - beforeInsert:function(h) { - openLinkMap('TINY','&clang='+markitup_getURLParam('clang') + '&category_id='+markitup_getURLParam('article_id')); - } - }, - {name:'Link media', className:'link-media', - beforeInsert:function(h) { - openMediaPool('TINY'); - } - }, - {name:'Link extern', className:'link-extern', openWith:'"', closeWith:'([![Title]!])":[![Link:!:http://]!]', placeHolder:'Ihr Text zum LINK hier...'}, - {name:'Link mail-to', className:'link-mailto', openWith:'"', closeWith:'([![Title]!])":[![Link:!:mailto:]!]', placeHolder:'Ihre E-Mailadresse hier...'}, - {separator:'---------------'}, - {name:'Quotes Block', className:'quotes', openWith:'bq(!(([![Class]!]))!). '}, - {name:'Code Block', className:'code', openWith:'bc(!(([![Class]!]))!). '}, - {separator:'---------------'}, - {name:'Tabs', className:'tabs', openWith:'\nnotextile.
\n\n', closeWith:'\nnotextile.
\n\n', placeHolder:'Ihr Inhalt im TAB...\n'}, - {name:'Accordion Headline', className:'accordion-headline', openWith:'\nh3(bar#accordion). ', placeHolder:'Ihr Titel hier...'}, - {name:'Accordion Content', className:'accordion-content', openWith:'\nnotextile.
\n\n', closeWith:'\nnotextile.
\n\n', placeHolder:'Ihr Inhalt im TAB...\n'}, - {separator:'---------------'}, - {name:'Table', className:'table', placeHolder:"Inhalt der Zelle...", - replaceWith:function(h) { - cols = prompt("Wie viele Spalten?"); - rows = prompt("Wie viele Reihen?"); - html = ""; - for (r = 0; r < rows; r++) - { - for (c = 0; c < cols; c++) - { - html += "|"+(h.placeHolder||""); - } - html += "|\n"; - } - return html; - } - } - ] + previewParserPath: '', // path to your Textile parser + onShiftEnter: {keepDefault:false, replaceWith:'
\n'}, + markupSet: + [ + {name:'Heading 1', className:'h1', key:'1', openWith:'\nh1(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, + {name:'Heading 2', className:'h2', key:'2', openWith:'\nh2(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, + {name:'Heading 3', className:'h3', key:'3', openWith:'\nh3(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, + {name:'Heading 4', className:'h4', key:'4', openWith:'\nh4(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, + {name:'Heading 5', className:'h5', key:'5', openWith:'\nh5(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, + {name:'Heading 6', className:'h6', key:'6', openWith:'\nh6(!(([![Class]!]))!). ', placeHolder:'Ihr Titel hier...'}, + {separator:'---------------'}, + {name:'Bold', key:'B', className:'bold', closeWith:'*', openWith:'*'}, + {name:'Italic', key:'I', className:'italic', closeWith:'_', openWith:'_'}, + {name:'Stroke through', key:'S', className:'stroke', closeWith:'-', openWith:'-'}, + {separator:'---------------'}, + {name:'Bulleted list', className:'list-bullet', openWith:'(!(* |!|*)!)'}, + {name:'Numeric list', className:'list-numeric', openWith:'(!(# |!|#)!)'}, + {separator:'---------------'}, + {name:'Image', className:'image', + beforeInsert:function(h) { + openMediaPool('TINYIMG'); + } + }, + {name:'Video', className:'video', + beforeInsert:function(h) { + openMediaPool('TINY'); + }, + openBlockWith:'notextile. ', + multiline:true + }, + {separator:'---------------'}, + {name:'Link intern Pop-Up', className:'link-intern', + beforeInsert:function(h) { + openLinkMap('TINY','&clang='+markitup_getURLParam('clang') + '&category_id='+markitup_getURLParam('article_id')); + } + }, + {name:'Link intern', className:'link-intern', + beforeInsert:function(h) { + openLinkMap('TINY','&clang='+markitup_getURLParam('clang') + '&category_id='+markitup_getURLParam('article_id')); + } + }, + {name:'Link media', className:'link-media', + beforeInsert:function(h) { + openMediaPool('TINY'); + } + }, + {name:'Link extern', className:'link-extern', openWith:'"', closeWith:'([![Title]!])":[![Link:!:http://]!]', placeHolder:'Ihr Text zum LINK hier...'}, + {name:'Link mail-to', className:'link-mailto', openWith:'"', closeWith:'([![Title]!])":[![Link:!:mailto:]!]', placeHolder:'Ihre E-Mailadresse hier...'}, + {separator:'---------------'}, + {name:'Quotes Block', className:'quotes', openWith:'bq(!(([![Class]!]))!). '}, + {name:'Code Block', className:'code', openWith:'bc(!(([![Class]!]))!). '}, + {separator:'---------------'}, + {name:'Tabs', className:'tabs', openWith:'\nnotextile.
\n\n', closeWith:'\nnotextile.
\n\n', placeHolder:'Ihr Inhalt im TAB...\n'}, + {name:'Accordion Headline', className:'accordion-headline', openWith:'\nh3(bar#accordion). ', placeHolder:'Ihr Titel hier...'}, + {name:'Accordion Content', className:'accordion-content', openWith:'\nnotextile.
\n\n', closeWith:'\nnotextile.
\n\n', placeHolder:'Ihr Inhalt im TAB...\n'}, + {separator:'---------------'}, + {name:'Table', className:'table', placeHolder:"Inhalt der Zelle...", + replaceWith:function(h) { + cols = prompt("Wie viele Spalten?"); + rows = prompt("Wie viele Reihen?"); + html = ""; + for (r = 0; r < rows; r++) + { + for (c = 0; c < cols; c++) + { + html += "|"+(h.placeHolder||""); + } + html += "|\n"; + } + return html; + } + } + ] } \ No newline at end of file diff --git a/files/sets/style.css b/files/sets/style.css index e159154..71c89df 100644 --- a/files/sets/style.css +++ b/files/sets/style.css @@ -41,6 +41,9 @@ .markItUp .image a { background-image:url(images/image.png); } +.markItUp .video a { + background-image:url(images/video.png); +} .markItUp .link-intern a { background-image:url(images/link-intern.png); }