mercury-rails 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/POST_INSTALL +15 -0
  2. data/README.md +27 -6
  3. data/VERSION +1 -1
  4. data/app/controllers/mercury_controller.rb +4 -4
  5. data/app/views/layouts/mercury.html.erb +14 -3
  6. data/app/views/mercury/panels/snippets.html +1 -1
  7. data/app/views/mercury/snippets/{example_options.html.erb → example/options.html.erb} +0 -0
  8. data/app/views/mercury/snippets/{example.html.erb → example/preview.html.erb} +0 -0
  9. data/config/routes.rb +2 -2
  10. data/features/loading/loading.feature +22 -0
  11. data/features/loading/navigating.feature +77 -0
  12. data/features/loading/user_interface.feature +67 -0
  13. data/features/regions/editable/advanced_editing.feature +0 -0
  14. data/features/regions/editable/basic_editing.feature +195 -0
  15. data/features/regions/editable/inserting_links.feature +98 -0
  16. data/features/regions/editable/inserting_media.feature +110 -0
  17. data/features/regions/editable/inserting_snippets.feature +103 -0
  18. data/features/regions/editable/inserting_special_characters.feature +24 -0
  19. data/features/regions/editable/inserting_tables.feature +109 -0
  20. data/features/regions/editable/pasting.feature +0 -0
  21. data/features/regions/editable/uploading_images.feature +0 -0
  22. data/features/regions/markupable/advanced_editing.feature +0 -0
  23. data/features/regions/markupable/basic_editing.feature +0 -0
  24. data/features/regions/markupable/inserting_links.feature +0 -0
  25. data/features/regions/markupable/inserting_media.feature +0 -0
  26. data/features/regions/markupable/inserting_snippets.feature +0 -0
  27. data/features/regions/markupable/inserting_special_characters.feature +0 -0
  28. data/features/regions/markupable/inserting_tables.feature +0 -0
  29. data/features/regions/markupable/uploading_images.feature +0 -0
  30. data/features/regions/snippetable/advanced_editing.feature +0 -0
  31. data/features/regions/snippetable/basic_editing.feature +0 -0
  32. data/features/regions/snippetable/inserting_snippets.feature +0 -0
  33. data/features/saving/saving.feature +33 -0
  34. data/features/step_definitions/debug_steps.rb +2 -2
  35. data/features/step_definitions/mercury_steps.rb +441 -0
  36. data/features/support/env.rb +3 -3
  37. data/features/support/mercury_contents.rb +25 -0
  38. data/features/support/mercury_selectors.rb +147 -0
  39. data/features/support/paths.rb +20 -18
  40. data/features/support/selectors.rb +5 -3
  41. data/lib/generators/mercury/install/install_generator.rb +14 -0
  42. data/mercury-rails.gemspec +50 -20
  43. data/spec/javascripts/mercury/lightview_spec.js.coffee +55 -27
  44. data/spec/javascripts/mercury/mercury_spec.js.coffee +3 -3
  45. data/spec/javascripts/mercury/modal_spec.js.coffee +2 -2
  46. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +0 -24
  47. data/spec/javascripts/mercury/page_editor_spec.js.coffee +148 -67
  48. data/spec/javascripts/mercury/panel_spec.js.coffee +2 -2
  49. data/spec/javascripts/mercury/region_spec.js.coffee +10 -7
  50. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +0 -20
  51. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +2 -2
  52. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +1 -1
  53. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +1 -1
  54. data/spec/javascripts/templates/mercury/page_editor.html +3 -3
  55. data/vendor/assets/images/mercury/close.png +0 -0
  56. data/vendor/assets/javascripts/mercury.js +140 -73
  57. data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/jquery-1.6.js +0 -0
  58. data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/jquery-ui-1.8.13.custom.js +0 -0
  59. data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/jquery.additions.js +0 -0
  60. data/vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +527 -0
  61. data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/liquidmetal.js +0 -0
  62. data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/showdown.js +0 -0
  63. data/vendor/assets/javascripts/mercury/lightview.js.coffee +5 -2
  64. data/vendor/assets/javascripts/mercury/mercury.js.coffee +9 -8
  65. data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +3 -1
  66. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +2 -2
  67. data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +6 -17
  68. data/vendor/assets/javascripts/mercury/page_editor.js.coffee +29 -8
  69. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +27 -0
  70. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +9 -0
  71. data/vendor/assets/javascripts/mercury/region.js.coffee +2 -2
  72. data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +89 -93
  73. data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +1 -1
  74. data/vendor/assets/javascripts/mercury/support/history.js +1 -0
  75. data/vendor/assets/javascripts/mercury/uploader.js.coffee +0 -1
  76. data/vendor/assets/javascripts/mercury_loader.js +4 -4
  77. data/vendor/assets/stylesheets/mercury/lightview.css +8 -0
  78. data/vendor/assets/stylesheets/mercury/mercury.css +12 -0
  79. data/vendor/assets/stylesheets/mercury/modal.css +0 -12
  80. data/vendor/assets/stylesheets/mercury/toolbar.css +1 -0
  81. data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
  82. metadata +73 -45
  83. data/app/views/mercury/lightviews/imageprocessor.html +0 -3
  84. data/app/views/mercury/modals/sanitizer.html +0 -9
  85. data/features/editing/basic.feature +0 -11
  86. data/vendor/assets/images/mercury/clippy.png +0 -0
@@ -21,7 +21,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
21
21
  @textarea.attr('class', @element.attr('class')).addClass('mercury-textarea')
22
22
  @textarea.css({border: 0, background: 'transparent', display: 'block', width: width, height: height, fontFamily: '"Courier New", Courier, monospace', fontSize: '14px'})
23
23
  @element.empty().append(@textarea)
24
- @element.removeClass('mercury-region')
24
+ @element.removeClass(Mercury.config.regionClass)
25
25
 
26
26
  @previewElement = jQuery('<div>', @document)
27
27
  @element.append(@previewElement)
@@ -0,0 +1 @@
1
+ (function(a,b){"use strict";var c=a.History=a.History||{};if(typeof c.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");c.Adapter={handlers:{},_uid:1,uid:function(a){return a._uid||(a._uid=c.Adapter._uid++)},bind:function(a,b,d){var e=c.Adapter.uid(a);c.Adapter.handlers[e]=c.Adapter.handlers[e]||{},c.Adapter.handlers[e][b]=c.Adapter.handlers[e][b]||[],c.Adapter.handlers[e][b].push(d),a["on"+b]=function(a,b){return function(d){c.Adapter.trigger(a,b,d)}}(a,b)},trigger:function(a,b,d){d=d||{};var e=c.Adapter.uid(a),f,g;c.Adapter.handlers[e]=c.Adapter.handlers[e]||{},c.Adapter.handlers[e][b]=c.Adapter.handlers[e][b]||[];for(f=0,g=c.Adapter.handlers[e][b].length;f<g;++f)c.Adapter.handlers[e][b][f].apply(this,[d])},extractEventData:function(a,c){var d=c&&c[a]||b;return d},onDomLoad:function(b){var c=a.setTimeout(function(){b()},2e3);a.onload=function(){clearTimeout(c),b()}}},typeof c.init!="undefined"&&c.init()})(window),function(a,b){"use strict";var c=a.console||b,d=a.document,e=a.navigator,f=a.sessionStorage||!1,g=a.setTimeout,h=a.clearTimeout,i=a.setInterval,j=a.clearInterval,k=a.JSON,l=a.alert,m=a.History=a.History||{},n=a.history;k.stringify=k.stringify||k.encode,k.parse=k.parse||k.decode;if(typeof m.init!="undefined")throw new Error("History.js Core has already been loaded...");m.init=function(){return typeof m.Adapter=="undefined"?!1:(typeof m.initCore!="undefined"&&m.initCore(),typeof m.initHtml4!="undefined"&&m.initHtml4(),!0)},m.initCore=function(){if(typeof m.initCore.initialized!="undefined")return!1;m.initCore.initialized=!0,m.options=m.options||{},m.options.hashChangeInterval=m.options.hashChangeInterval||100,m.options.safariPollInterval=m.options.safariPollInterval||500,m.options.doubleCheckInterval=m.options.doubleCheckInterval||500,m.options.storeInterval=m.options.storeInterval||1e3,m.options.busyDelay=m.options.busyDelay||250,m.options.debug=m.options.debug||!1,m.options.initialTitle=m.options.initialTitle||d.title,m.intervalList=[],m.clearAllIntervals=function(){var a,b=m.intervalList;if(typeof b!="undefined"&&b!==null){for(a=0;a<b.length;a++)j(b[a]);m.intervalList=null}},m.debug=function(){(m.options.debug||!1)&&m.log.apply(m,arguments)},m.log=function(){var a=typeof c!="undefined"&&typeof c.log!="undefined"&&typeof c.log.apply!="undefined",b=d.getElementById("log"),e,f,g,h,i;a?(h=Array.prototype.slice.call(arguments),e=h.shift(),typeof c.debug!="undefined"?c.debug.apply(c,[e,h]):c.log.apply(c,[e,h])):e="\n"+arguments[0]+"\n";for(f=1,g=arguments.length;f<g;++f){i=arguments[f];if(typeof i=="object"&&typeof k!="undefined")try{i=k.stringify(i)}catch(j){}e+="\n"+i+"\n"}return b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||l(e),!0},m.getInternetExplorerMajorVersion=function(){var a=m.getInternetExplorerMajorVersion.cached=typeof m.getInternetExplorerMajorVersion.cached!="undefined"?m.getInternetExplorerMajorVersion.cached:function(){var a=3,b=d.createElement("div"),c=b.getElementsByTagName("i");while((b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window)
@@ -90,7 +90,6 @@ jQuery.extend Mercury.uploader, {
90
90
  jQuery.each ['onloadstart', 'onprogress', 'onload', 'onabort', 'onerror'], (index, eventName) =>
91
91
  xhr.upload[eventName] = (event) => @uploaderEvents[eventName].call(@, event)
92
92
  xhr.onload = (event) =>
93
- console.debug(event)
94
93
  if (event.currentTarget.status >= 400)
95
94
  @updateStatus('Error: Unable to upload the file')
96
95
  alert("#{event.currentTarget.status}: Unable to process response")
@@ -107,9 +107,9 @@ if (!window.mercuryPackages) window.mercuryPackages = {
107
107
  setTimeout(function() {
108
108
  // Once we're ready to load Mercury we clear the document contents, and add in the css and javascript tags.
109
109
  // Once the script has loaded we display the body again, and instantiate a new instance of Mercury.PageEditor.
110
- document.body.innerHTML = '&nbsp;';
110
+ document.body.innerHTML = '<div style="height:0;overflow:hidden;">Mercury</div>';
111
111
  for (i = 0; i <= document.styleSheets.length - 1; i += 1) {
112
- document.styleSheets[i].disabled = true
112
+ document.styleSheets[i].disabled = true;
113
113
  }
114
114
 
115
115
  // Load all the stylesheets.
@@ -137,7 +137,7 @@ if (!window.mercuryPackages) window.mercuryPackages = {
137
137
  document.body.style.visibility = 'visible';
138
138
  document.body.style.display = 'block';
139
139
  // Instantiate the PageEditor, passing in the options that were provided to the loader.
140
- new Mercury.PageEditor(null, {visible: true});
140
+ new Mercury.PageEditor(null, options);
141
141
  // If there's a mercuryLoaded function available, call it. You can provide one before the loading script
142
142
  // and it will be called after everything is loaded, but before everything is initialized. You can bind
143
143
  // to the mercury:ready event or use Mercury.bind('ready', function() {}).
@@ -147,7 +147,7 @@ if (!window.mercuryPackages) window.mercuryPackages = {
147
147
  } else {
148
148
  loadScript(javascripts[loaded]);
149
149
  }
150
- }
150
+ };
151
151
  }
152
152
  loadScript(javascripts[loaded]);
153
153
  }, 1);
@@ -48,6 +48,14 @@
48
48
  white-space: nowrap;
49
49
  text-shadow: 1px 1px 2px rgba(100, 100, 100, .5);
50
50
  }
51
+ .mercury-lightview h1.mercury-lightview-title a.mercury-lightview-close {
52
+ float: right;
53
+ width: 32px;
54
+ height: 42px;
55
+ margin: -14px -20px;
56
+ background: url(/assets/mercury/close.png) no-repeat center;
57
+ }
58
+
51
59
  /*
52
60
  * Forms
53
61
  *----------------------------------------------------------------------------*/
@@ -16,6 +16,18 @@ html, body {
16
16
  overflow: hidden;
17
17
  }
18
18
 
19
+ .mercury-iframe {
20
+ position: absolute;
21
+ top: 0;
22
+ width: 100%;
23
+ visibility: hidden;
24
+ }
25
+
26
+ .mercury-focusable {
27
+ position: absolute;
28
+ opacity: 0;
29
+ }
30
+
19
31
 
20
32
  /*
21
33
  * Forms
@@ -130,18 +130,6 @@
130
130
  border: 0;
131
131
  margin-top: -2px;
132
132
  }
133
- /* html sanitizer (when pasting from msword) */
134
- #mercury_sanitizer .information {
135
- background: url(/assets/mercury/clippy.png) no-repeat top left;
136
- min-height: 65px;
137
- padding-left: 50px;
138
- margin-bottom: 10px;
139
- }
140
- #mercury_sanitizer textarea {
141
- width: 100%;
142
- font-family: monospace;
143
- white-space: pre;
144
- }
145
133
  /* character */
146
134
  #mercury_character .character {
147
135
  float: left;
@@ -14,6 +14,7 @@
14
14
  -webkit-user-select: none;
15
15
  -moz-user-select: none;
16
16
  user-select: none;
17
+ background: #DDD;
17
18
  background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(198,198,198)), color-stop(1, rgb(226,225,226)));
18
19
  background-image: -moz-linear-gradient(center bottom, rgb(198,198,198) 0%, rgb(226,225,226) 100%);
19
20
  border-bottom: 1px solid #727272;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Mercury Editor is a Coffeescript and jQuery based WYSIWYG editor. Documentation and other useful information can be
3
+ * found at https://github.com/jejacks0n/mercury
4
+ *
5
+ * This file is intended to provide a standard way to override the CSS that comes default with Mercury Editor, and
6
+ * includes an example button style, should you ever need to add new ones yourself. Read the toolbar configuration in
7
+ * mercury.js for more on how to add your own buttons to the toolbar.
8
+ */
9
+
10
+ /* Disable text sizing in webkit (ipad/iphone etc -- should apply to mercury only) */
11
+ html { -webkit-text-size-adjust: none; }
12
+
13
+ /* Button example */
14
+ .mercury-primary-toolbar .mercury-inspector-button em,
15
+ .mercury-expander-button[data-button="inspector"] em {
16
+ background-image: url(/assets/mercury/toolbar/primary/inspectorpanel.png);
17
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercury-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-25 00:00:00.000000000 -06:00
13
- default_executable:
12
+ date: 2011-10-24 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
- requirement: &2185441740 !ruby/object:Gem::Requirement
16
+ requirement: &70222954560820 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: 3.1.0
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2185441740
24
+ version_requirements: *70222954560820
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: paperclip
28
- requirement: &2185441240 !ruby/object:Gem::Requirement
27
+ requirement: &70222954559760 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2185441240
35
+ version_requirements: *70222954559760
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: formtastic
39
- requirement: &2185440740 !ruby/object:Gem::Requirement
38
+ requirement: &70222954540560 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,10 +43,10 @@ dependencies:
44
43
  version: '0'
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *2185440740
46
+ version_requirements: *70222954540560
48
47
  - !ruby/object:Gem::Dependency
49
48
  name: json
50
- requirement: &2185440220 !ruby/object:Gem::Requirement
49
+ requirement: &70222954525380 !ruby/object:Gem::Requirement
51
50
  none: false
52
51
  requirements:
53
52
  - - ! '>='
@@ -55,10 +54,10 @@ dependencies:
55
54
  version: '0'
56
55
  type: :runtime
57
56
  prerelease: false
58
- version_requirements: *2185440220
57
+ version_requirements: *70222954525380
59
58
  - !ruby/object:Gem::Dependency
60
59
  name: sass-rails
61
- requirement: &2185439720 !ruby/object:Gem::Requirement
60
+ requirement: &70222954511000 !ruby/object:Gem::Requirement
62
61
  none: false
63
62
  requirements:
64
63
  - - ! '>='
@@ -66,10 +65,10 @@ dependencies:
66
65
  version: '0'
67
66
  type: :runtime
68
67
  prerelease: false
69
- version_requirements: *2185439720
68
+ version_requirements: *70222954511000
70
69
  - !ruby/object:Gem::Dependency
71
70
  name: coffee-script
72
- requirement: &2185439220 !ruby/object:Gem::Requirement
71
+ requirement: &70222954506180 !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
74
  - - ! '>='
@@ -77,10 +76,10 @@ dependencies:
77
76
  version: '0'
78
77
  type: :runtime
79
78
  prerelease: false
80
- version_requirements: *2185439220
79
+ version_requirements: *70222954506180
81
80
  - !ruby/object:Gem::Dependency
82
81
  name: rocco
83
- requirement: &2185438700 !ruby/object:Gem::Requirement
82
+ requirement: &70222954502320 !ruby/object:Gem::Requirement
84
83
  none: false
85
84
  requirements:
86
85
  - - ! '>='
@@ -88,10 +87,10 @@ dependencies:
88
87
  version: '0'
89
88
  type: :development
90
89
  prerelease: false
91
- version_requirements: *2185438700
90
+ version_requirements: *70222954502320
92
91
  - !ruby/object:Gem::Dependency
93
92
  name: uglifier
94
- requirement: &2185438200 !ruby/object:Gem::Requirement
93
+ requirement: &70222954496080 !ruby/object:Gem::Requirement
95
94
  none: false
96
95
  requirements:
97
96
  - - ! '>='
@@ -99,10 +98,10 @@ dependencies:
99
98
  version: '0'
100
99
  type: :development
101
100
  prerelease: false
102
- version_requirements: *2185438200
101
+ version_requirements: *70222954496080
103
102
  - !ruby/object:Gem::Dependency
104
103
  name: jquery-rails
105
- requirement: &2185437700 !ruby/object:Gem::Requirement
104
+ requirement: &70222949933400 !ruby/object:Gem::Requirement
106
105
  none: false
107
106
  requirements:
108
107
  - - ! '>='
@@ -110,10 +109,10 @@ dependencies:
110
109
  version: '0'
111
110
  type: :development
112
111
  prerelease: false
113
- version_requirements: *2185437700
112
+ version_requirements: *70222949933400
114
113
  - !ruby/object:Gem::Dependency
115
114
  name: jeweler
116
- requirement: &2185437160 !ruby/object:Gem::Requirement
115
+ requirement: &70222949929940 !ruby/object:Gem::Requirement
117
116
  none: false
118
117
  requirements:
119
118
  - - ! '>='
@@ -121,10 +120,10 @@ dependencies:
121
120
  version: '0'
122
121
  type: :development
123
122
  prerelease: false
124
- version_requirements: *2185437160
123
+ version_requirements: *70222949929940
125
124
  - !ruby/object:Gem::Dependency
126
125
  name: sqlite3
127
- requirement: &2185436660 !ruby/object:Gem::Requirement
126
+ requirement: &70222949924760 !ruby/object:Gem::Requirement
128
127
  none: false
129
128
  requirements:
130
129
  - - ! '>='
@@ -132,10 +131,10 @@ dependencies:
132
131
  version: '0'
133
132
  type: :development
134
133
  prerelease: false
135
- version_requirements: *2185436660
134
+ version_requirements: *70222949924760
136
135
  - !ruby/object:Gem::Dependency
137
136
  name: thin
138
- requirement: &2185436160 !ruby/object:Gem::Requirement
137
+ requirement: &70222949920740 !ruby/object:Gem::Requirement
139
138
  none: false
140
139
  requirements:
141
140
  - - ! '>='
@@ -143,10 +142,10 @@ dependencies:
143
142
  version: '0'
144
143
  type: :development
145
144
  prerelease: false
146
- version_requirements: *2185436160
145
+ version_requirements: *70222949920740
147
146
  - !ruby/object:Gem::Dependency
148
147
  name: ruby-debug19
149
- requirement: &2185435640 !ruby/object:Gem::Requirement
148
+ requirement: &70222949893740 !ruby/object:Gem::Requirement
150
149
  none: false
151
150
  requirements:
152
151
  - - ! '>='
@@ -154,10 +153,10 @@ dependencies:
154
153
  version: '0'
155
154
  type: :development
156
155
  prerelease: false
157
- version_requirements: *2185435640
156
+ version_requirements: *70222949893740
158
157
  - !ruby/object:Gem::Dependency
159
158
  name: evergreen
160
- requirement: &2185435140 !ruby/object:Gem::Requirement
159
+ requirement: &70222949888300 !ruby/object:Gem::Requirement
161
160
  none: false
162
161
  requirements:
163
162
  - - ! '>='
@@ -165,7 +164,7 @@ dependencies:
165
164
  version: '0'
166
165
  type: :development
167
166
  prerelease: false
168
- version_requirements: *2185435140
167
+ version_requirements: *70222949888300
169
168
  description: A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript
170
169
  on top of Rails 3.1
171
170
  email: jejacks0n@gmail.com
@@ -176,6 +175,7 @@ extra_rdoc_files:
176
175
  - README.md
177
176
  files:
178
177
  - LICENSE
178
+ - POST_INSTALL
179
179
  - README.md
180
180
  - VERSION
181
181
  - annotated_source.template
@@ -184,12 +184,10 @@ files:
184
184
  - app/models/image.rb
185
185
  - app/views/layouts/mercury.html.erb
186
186
  - app/views/mercury/lightviews/about.html
187
- - app/views/mercury/lightviews/imageprocessor.html
188
187
  - app/views/mercury/modals/character.html
189
188
  - app/views/mercury/modals/htmleditor.html
190
189
  - app/views/mercury/modals/link.html
191
190
  - app/views/mercury/modals/media.html
192
- - app/views/mercury/modals/sanitizer.html
193
191
  - app/views/mercury/modals/table.html
194
192
  - app/views/mercury/palettes/backcolor.html
195
193
  - app/views/mercury/palettes/forecolor.html
@@ -198,15 +196,41 @@ files:
198
196
  - app/views/mercury/panels/snippets.html
199
197
  - app/views/mercury/selects/formatblock.html
200
198
  - app/views/mercury/selects/style.html
201
- - app/views/mercury/snippets/example.html.erb
202
- - app/views/mercury/snippets/example_options.html.erb
199
+ - app/views/mercury/snippets/example/options.html.erb
200
+ - app/views/mercury/snippets/example/preview.html.erb
203
201
  - config/engine.rb
204
202
  - config/routes.rb
205
203
  - db/migrate/20110526035601_create_images.rb
206
- - features/editing/basic.feature
204
+ - features/loading/loading.feature
205
+ - features/loading/navigating.feature
206
+ - features/loading/user_interface.feature
207
+ - features/regions/editable/advanced_editing.feature
208
+ - features/regions/editable/basic_editing.feature
209
+ - features/regions/editable/inserting_links.feature
210
+ - features/regions/editable/inserting_media.feature
211
+ - features/regions/editable/inserting_snippets.feature
212
+ - features/regions/editable/inserting_special_characters.feature
213
+ - features/regions/editable/inserting_tables.feature
214
+ - features/regions/editable/pasting.feature
215
+ - features/regions/editable/uploading_images.feature
216
+ - features/regions/markupable/advanced_editing.feature
217
+ - features/regions/markupable/basic_editing.feature
218
+ - features/regions/markupable/inserting_links.feature
219
+ - features/regions/markupable/inserting_media.feature
220
+ - features/regions/markupable/inserting_snippets.feature
221
+ - features/regions/markupable/inserting_special_characters.feature
222
+ - features/regions/markupable/inserting_tables.feature
223
+ - features/regions/markupable/uploading_images.feature
224
+ - features/regions/snippetable/advanced_editing.feature
225
+ - features/regions/snippetable/basic_editing.feature
226
+ - features/regions/snippetable/inserting_snippets.feature
227
+ - features/saving/saving.feature
207
228
  - features/step_definitions/debug_steps.rb
229
+ - features/step_definitions/mercury_steps.rb
208
230
  - features/step_definitions/web_steps.rb
209
231
  - features/support/env.rb
232
+ - features/support/mercury_contents.rb
233
+ - features/support/mercury_selectors.rb
210
234
  - features/support/paths.rb
211
235
  - features/support/selectors.rb
212
236
  - lib/generators/mercury/install/install_generator.rb
@@ -281,7 +305,7 @@ files:
281
305
  - spec/javascripts/templates/mercury/tooltip.html
282
306
  - spec/javascripts/templates/mercury/uploader.html
283
307
  - vendor/assets/images/mercury/button.png
284
- - vendor/assets/images/mercury/clippy.png
308
+ - vendor/assets/images/mercury/close.png
285
309
  - vendor/assets/images/mercury/default-snippet.png
286
310
  - vendor/assets/images/mercury/loading-dark.gif
287
311
  - vendor/assets/images/mercury/loading-light.gif
@@ -304,6 +328,12 @@ files:
304
328
  - vendor/assets/images/mercury/toolbar/primary/undo.png
305
329
  - vendor/assets/images/mercury/toolbar/snippetable/buttons.png
306
330
  - vendor/assets/javascripts/mercury.js
331
+ - vendor/assets/javascripts/mercury/dependencies/jquery-1.6.js
332
+ - vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js
333
+ - vendor/assets/javascripts/mercury/dependencies/jquery.additions.js
334
+ - vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js
335
+ - vendor/assets/javascripts/mercury/dependencies/liquidmetal.js
336
+ - vendor/assets/javascripts/mercury/dependencies/showdown.js
307
337
  - vendor/assets/javascripts/mercury/dialog.js.coffee
308
338
  - vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee
309
339
  - vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee
@@ -325,6 +355,8 @@ files:
325
355
  - vendor/assets/javascripts/mercury/page_editor.js.coffee
326
356
  - vendor/assets/javascripts/mercury/palette.js.coffee
327
357
  - vendor/assets/javascripts/mercury/panel.js.coffee
358
+ - vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee
359
+ - vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js
328
360
  - vendor/assets/javascripts/mercury/region.js.coffee
329
361
  - vendor/assets/javascripts/mercury/regions/editable.js.coffee
330
362
  - vendor/assets/javascripts/mercury/regions/markupable.js.coffee
@@ -333,6 +365,7 @@ files:
333
365
  - vendor/assets/javascripts/mercury/snippet.js.coffee
334
366
  - vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee
335
367
  - vendor/assets/javascripts/mercury/statusbar.js.coffee
368
+ - vendor/assets/javascripts/mercury/support/history.js
336
369
  - vendor/assets/javascripts/mercury/table_editor.js.coffee
337
370
  - vendor/assets/javascripts/mercury/toolbar.button.js.coffee
338
371
  - vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee
@@ -340,11 +373,6 @@ files:
340
373
  - vendor/assets/javascripts/mercury/toolbar.js.coffee
341
374
  - vendor/assets/javascripts/mercury/tooltip.js.coffee
342
375
  - vendor/assets/javascripts/mercury/uploader.js.coffee
343
- - vendor/assets/javascripts/mercury_dependencies/jquery-1.6.js
344
- - vendor/assets/javascripts/mercury_dependencies/jquery-ui-1.8.13.custom.js
345
- - vendor/assets/javascripts/mercury_dependencies/jquery.additions.js
346
- - vendor/assets/javascripts/mercury_dependencies/liquidmetal.js
347
- - vendor/assets/javascripts/mercury_dependencies/showdown.js
348
376
  - vendor/assets/javascripts/mercury_loader.js
349
377
  - vendor/assets/stylesheets/mercury.css
350
378
  - vendor/assets/stylesheets/mercury/dialog.css
@@ -355,7 +383,7 @@ files:
355
383
  - vendor/assets/stylesheets/mercury/toolbar.css
356
384
  - vendor/assets/stylesheets/mercury/tooltip.css
357
385
  - vendor/assets/stylesheets/mercury/uploader.css
358
- has_rdoc: true
386
+ - vendor/assets/stylesheets/mercury_overrides.css
359
387
  homepage: http://github.com/jejacks0n/mercury
360
388
  licenses:
361
389
  - MIT
@@ -371,7 +399,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
399
  version: '0'
372
400
  segments:
373
401
  - 0
374
- hash: 2650267615471904873
402
+ hash: 849858484813898948
375
403
  required_rubygems_version: !ruby/object:Gem::Requirement
376
404
  none: false
377
405
  requirements:
@@ -380,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
408
  version: '0'
381
409
  requirements: []
382
410
  rubyforge_project:
383
- rubygems_version: 1.6.2
411
+ rubygems_version: 1.8.10
384
412
  signing_key:
385
413
  specification_version: 3
386
414
  summary: A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript