').css({
- 'animation': animation,
- '-webkit-animation': animation,
- }));
- }
- var styleElt = crel('style', {
- type : 'text/css'
- });
- document.head.appendChild(styleElt);
- styleElt.innerHTML = styleContent;
- };
-
- return workingIndicator;
-});
-
-/**
- * jGrowl 1.2.13
- *
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- *
- * Written by Stan Lemon
- * Last updated: 2013.02.22
- *
- * jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These
- * notifications function similarly to the Growl Framework available for
- * Mac OS X (http://growl.info).
- *
- * To Do:
- * - Move library settings to containers and allow them to be changed per container
- *
- * Changes in 1.2.13
- * - Fixed clearing interval when the container shuts down
- *
- * Changes in 1.2.12
- * - Added compressed versions using UglifyJS and Sqwish
- * - Improved README with configuration options explanation
- * - Added a source map
- *
- * Changes in 1.2.11
- * - Fix artifacts left behind by the shutdown method and text-cleanup
- *
- * Changes in 1.2.10
- * - Fix beforeClose to be called in click event
- *
- * Changes in 1.2.9
- * - Fixed BC break in jQuery 2.0 beta
- *
- * Changes in 1.2.8
- * - Fixes for jQuery 1.9 and the MSIE6 check, note that with jQuery 2.0 support
- * jGrowl intends to drop support for IE6 altogether
- *
- * Changes in 1.2.6
- * - Fixed js error when a notification is opening and closing at the same time
- *
- * Changes in 1.2.5
- * - Changed wrapper jGrowl's options usage to "o" instead of $.jGrowl.defaults
- * - Added themeState option to control 'highlight' or 'error' for jQuery UI
- * - Ammended some CSS to provide default positioning for nested usage.
- * - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues
- * - Added two new options - openDuration and closeDuration to allow
- * better control of notification open and close speeds, respectively
- * Patch contributed by Jesse Vincet.
- * - Added afterOpen callback. Patch contributed by Russel Branca.
- *
- * Changes in 1.2.4
- * - Fixed IE bug with the close-all button
- * - Fixed IE bug with the filter CSS attribute (special thanks to gotwic)
- * - Update IE opacity CSS
- * - Changed font sizes to use "em", and only set the base style
- *
- * Changes in 1.2.3
- * - The callbacks no longer use the container as context, instead they use the actual notification
- * - The callbacks now receive the container as a parameter after the options parameter
- * - beforeOpen and beforeClose now check the return value, if it's false - the notification does
- * not continue. The open callback will also halt execution if it returns false.
- * - Fixed bug where containers would get confused
- * - Expanded the pause functionality to pause an entire container.
- *
- * Changes in 1.2.2
- * - Notification can now be theme rolled for jQuery UI, special thanks to Jeff Chan!
- *
- * Changes in 1.2.1
- * - Fixed instance where the interval would fire the close method multiple times.
- * - Added CSS to hide from print media
- * - Fixed issue with closer button when div { position: relative } is set
- * - Fixed leaking issue with multiple containers. Special thanks to Matthew Hanlon!
- *
- * Changes in 1.2.0
- * - Added message pooling to limit the number of messages appearing at a given time.
- * - Closing a notification is now bound to the notification object and triggered by the close button.
- *
- * Changes in 1.1.2
- * - Added iPhone styled example
- * - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
- * - Added template for the close button, so that it's content could be customized.
- *
- * Changes in 1.1.1
- * - Fixed CSS styling bug for ie6 caused by a mispelling
- * - Changes height restriction on default notifications to min-height
- * - Added skinned examples using a variety of images
- * - Added the ability to customize the content of the [close all] box
- * - Added jTweet, an example of using jGrowl + Twitter
- *
- * Changes in 1.1.0
- * - Multiple container and instances.
- * - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container.
- * - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName)
- * - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container
- * - Added new log callback which is called before anything is done for the notification
- * - Corner's attribute are now applied on an individual notification basis.
- *
- * Changes in 1.0.4
- * - Various CSS fixes so that jGrowl renders correctly in IE6.
- *
- * Changes in 1.0.3
- * - Fixed bug with options persisting across notifications
- * - Fixed theme application bug
- * - Simplified some selectors and manipulations.
- * - Added beforeOpen and beforeClose callbacks
- * - Reorganized some lines of code to be more readable
- * - Removed unnecessary this.defaults context
- * - If corners plugin is present, it's now customizable.
- * - Customizable open animation.
- * - Customizable close animation.
- * - Customizable animation easing.
- * - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center)
- *
- * Changes in 1.0.2
- * - All CSS styling is now external.
- * - Added a theme parameter which specifies a secondary class for styling, such
- * that notifications can be customized in appearance on a per message basis.
- * - Notification life span is now customizable on a per message basis.
- * - Added the ability to disable the global closer, enabled by default.
- * - Added callbacks for when a notification is opened or closed.
- * - Added callback for the global closer.
- * - Customizable animation speed.
- * - jGrowl now set itself up and tears itself down.
- *
- * Changes in 1.0.1:
- * - Removed dependency on metadata plugin in favor of .data()
- * - Namespaced all events
- */
-(function($) {
- /** Compatibility holdover for 1.9 to check IE6 **/
- var $ie6 = (function(){
- return false === $.support.boxModel && $.support.objectAll && $.support.leadingWhitespace;
- })();
-
- /** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
- $.jGrowl = function( m , o ) {
- // To maintain compatibility with older version that only supported one instance we'll create the base container.
- if ( $('#jGrowl').size() == 0 )
- $('
').addClass( (o && o.position) ? o.position : $.jGrowl.defaults.position ).appendTo('body');
-
- // Create a notification on the container.
- $('#jGrowl').jGrowl(m,o);
- };
-
-
- /** Raise jGrowl Notification on a jGrowl Container **/
- $.fn.jGrowl = function( m , o ) {
- if ( $.isFunction(this.each) ) {
- var args = arguments;
-
- return this.each(function() {
- /** Create a jGrowl Instance on the Container if it does not exist **/
- if ( $(this).data('jGrowl.instance') == undefined ) {
- $(this).data('jGrowl.instance', $.extend( new $.fn.jGrowl(), { notifications: [], element: null, interval: null } ));
- $(this).data('jGrowl.instance').startup( this );
- }
-
- /** Optionally call jGrowl instance methods, or just raise a normal notification **/
- if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) {
- $(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) );
- } else {
- $(this).data('jGrowl.instance').create( m , o );
- }
- });
- };
- };
-
- $.extend( $.fn.jGrowl.prototype , {
-
- /** Default JGrowl Settings **/
- defaults: {
- pool: 0,
- header: '',
- group: '',
- sticky: false,
- position: 'top-right',
- glue: 'after',
- theme: 'default',
- themeState: 'highlight',
- corners: '10px',
- check: 250,
- life: 3000,
- closeDuration: 'normal',
- openDuration: 'normal',
- easing: 'swing',
- closer: true,
- closeTemplate: '×',
- closerTemplate: '[ close all ]
',
- log: function() {},
- beforeOpen: function() {},
- afterOpen: function() {},
- open: function() {},
- beforeClose: function() {},
- close: function() {},
- animateOpen: {
- opacity: 'show'
- },
- animateClose: {
- opacity: 'hide'
- }
- },
-
- notifications: [],
-
- /** jGrowl Container Node **/
- element: null,
-
- /** Interval Function **/
- interval: null,
-
- /** Create a Notification **/
- create: function( message , o ) {
- var o = $.extend({}, this.defaults, o);
-
- /* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */
- if (typeof o.speed !== 'undefined') {
- o.openDuration = o.speed;
- o.closeDuration = o.speed;
- }
-
- this.notifications.push({ message: message , options: o });
-
- o.log.apply( this.element , [this.element,message,o] );
- },
-
- render: function( notification ) {
- var self = this;
- var message = notification.message;
- var o = notification.options;
-
- // Support for jQuery theme-states, if this is not used it displays a widget header
- o.themeState = (o.themeState == '') ? '' : 'ui-state-' + o.themeState;
-
- var notification = $('
')
- .addClass('jGrowl-notification ' + o.themeState + ' ui-corner-all' + ((o.group != undefined && o.group != '') ? ' ' + o.group : ''))
- .append($('
').addClass('jGrowl-close').html(o.closeTemplate))
- .append($('
').addClass('jGrowl-header').html(o.header))
- .append($('
').addClass('jGrowl-message').html(message))
- .data("jGrowl", o).addClass(o.theme).children('div.jGrowl-close').bind("click.jGrowl", function() {
- $(this).parent().trigger('jGrowl.beforeClose');
- })
- .parent();
-
-
- /** Notification Actions **/
- $(notification).bind("mouseover.jGrowl", function() {
- $('div.jGrowl-notification', self.element).data("jGrowl.pause", true);
- }).bind("mouseout.jGrowl", function() {
- $('div.jGrowl-notification', self.element).data("jGrowl.pause", false);
- }).bind('jGrowl.beforeOpen', function() {
- if ( o.beforeOpen.apply( notification , [notification,message,o,self.element] ) !== false ) {
- $(this).trigger('jGrowl.open');
- }
- }).bind('jGrowl.open', function() {
- if ( o.open.apply( notification , [notification,message,o,self.element] ) !== false ) {
- if ( o.glue == 'after' ) {
- $('div.jGrowl-notification:last', self.element).after(notification);
- } else {
- $('div.jGrowl-notification:first', self.element).before(notification);
- }
-
- $(this).animate(o.animateOpen, o.openDuration, o.easing, function() {
- // Fixes some anti-aliasing issues with IE filters.
- if ($.support.opacity === false)
- this.style.removeAttribute('filter');
-
- if ( $(this).data("jGrowl") !== null ) // Happens when a notification is closing before it's open.
- $(this).data("jGrowl").created = new Date();
-
- $(this).trigger('jGrowl.afterOpen');
- });
- }
- }).bind('jGrowl.afterOpen', function() {
- o.afterOpen.apply( notification , [notification,message,o,self.element] );
- }).bind('jGrowl.beforeClose', function() {
- if ( o.beforeClose.apply( notification , [notification,message,o,self.element] ) !== false )
- $(this).trigger('jGrowl.close');
- }).bind('jGrowl.close', function() {
- // Pause the notification, lest during the course of animation another close event gets called.
- $(this).data('jGrowl.pause', true);
- $(this).animate(o.animateClose, o.closeDuration, o.easing, function() {
- if ( $.isFunction(o.close) ) {
- if ( o.close.apply( notification , [notification,message,o,self.element] ) !== false )
- $(this).remove();
- } else {
- $(this).remove();
- }
- });
- }).trigger('jGrowl.beforeOpen');
-
- /** Optional Corners Plugin **/
- if ( o.corners != '' && $.fn.corner != undefined ) $(notification).corner( o.corners );
-
- /** Add a Global Closer if more than one notification exists **/
- if ( $('div.jGrowl-notification:parent', self.element).size() > 1 &&
- $('div.jGrowl-closer', self.element).size() == 0 && this.defaults.closer !== false ) {
- $(this.defaults.closerTemplate).addClass('jGrowl-closer ' + this.defaults.themeState + ' ui-corner-all').addClass(this.defaults.theme)
- .appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
- .bind("click.jGrowl", function() {
- $(this).siblings().trigger("jGrowl.beforeClose");
-
- if ( $.isFunction( self.defaults.closer ) ) {
- self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
- }
- });
- };
- },
-
- /** Update the jGrowl Container, removing old jGrowl notifications **/
- update: function() {
- $(this.element).find('div.jGrowl-notification:parent').each( function() {
- if ( $(this).data("jGrowl") != undefined && $(this).data("jGrowl").created !== undefined &&
- ($(this).data("jGrowl").created.getTime() + parseInt($(this).data("jGrowl").life)) < (new Date()).getTime() &&
- $(this).data("jGrowl").sticky !== true &&
- ($(this).data("jGrowl.pause") == undefined || $(this).data("jGrowl.pause") !== true) ) {
-
- // Pause the notification, lest during the course of animation another close event gets called.
- $(this).trigger('jGrowl.beforeClose');
- }
- });
-
- if ( this.notifications.length > 0 &&
- (this.defaults.pool == 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) )
- this.render( this.notifications.shift() );
-
- if ( $(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
- $(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
- $(this).remove();
- });
- }
- },
-
- /** Setup the jGrowl Notification Container **/
- startup: function(e) {
- this.element = $(e).addClass('jGrowl').append('
');
- this.interval = setInterval( function() {
- $(e).data('jGrowl.instance').update();
- }, parseInt(this.defaults.check));
-
- if ($ie6) {
- $(this.element).addClass('ie6');
- }
- },
-
- /** Shutdown jGrowl, removing it and clearing the interval **/
- shutdown: function() {
- $(this.element).removeClass('jGrowl')
- .find('div.jGrowl-notification').trigger('jGrowl.close')
- .parent().empty()
-
- clearInterval(this.interval);
- },
-
- close: function() {
- $(this.element).find('div.jGrowl-notification').each(function(){
- $(this).trigger('jGrowl.beforeClose');
- });
- }
- });
-
- /** Reference the Defaults Object for compatibility with older versions of jGrowl **/
- $.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
-
-})(jQuery);
-define("jgrowl", (function (global) {
- return function () {
- var ret, fn;
- return ret || global.jQuery.jGrowl;
- };
-}(this)));
-
-define('text!html/notificationsSettingsBlock.html',[],function () { return 'Shows notification messages in the bottom-right corner of the\n\tscreen.
\n';});
-
-define('extensions/notifications',[
- // "jquery",
- "underscore",
- "utils",
- "logger",
- "classes/Extension",
- "jgrowl",
- "text!html/notificationsSettingsBlock.html",
-], function(_, utils, logger, Extension, jGrowl, notificationsSettingsBlockHTML) {
-
- var notifications = new Extension("notifications", "Notifications");
- notifications.settingsBlock = notificationsSettingsBlockHTML;
- notifications.defaultConfig = {
- timeout: 8000
- };
-
- notifications.onLoadSettings = function() {
- utils.setInputValue("#input-notifications-timeout", notifications.config.timeout);
- };
-
- notifications.onSaveSettings = function(newConfig, event) {
- newConfig.timeout = utils.getInputIntValue("#input-notifications-timeout", event, 1, 60000);
- };
-
- var isInit = false;
- function init() {
- if(isInit === false) {
- // jGrowl configuration
- jGrowl.defaults.life = notifications.config.timeout;
- jGrowl.defaults.closer = false;
- jGrowl.defaults.closeTemplate = '';
- jGrowl.defaults.position = 'bottom-right';
- isInit = true;
- }
- }
-
- function showMessage(message, iconClass, options) {
- logger.info(message);
- init();
- if(!message) {
- return;
- }
- var endOfMsg = message.indexOf("|");
- if(endOfMsg !== -1) {
- message = message.substring(0, endOfMsg);
- if(!message) {
- return;
- }
- }
- options = options || {};
- iconClass = iconClass || "icon-info-circled";
- jGrowl(" " + _.escape(message).replace(/\n/g, ' '), options);
- }
-
- var isReady = false;
- var $offlineStatusElt;
- var $extensionButtonsElt;
- notifications.onReady = function() {
- isReady = true;
- $offlineStatusElt = $('.navbar .offline-status');
- $extensionButtonsElt = $('.navbar .extension-buttons');
- updateOnlineStatus();
- };
-
- notifications.onMessage = function(message) {
- showMessage(message);
- };
-
- notifications.onError = function(error) {
- logger.error(error);
- if(_.isString(error)) {
- showMessage(error, "icon-attention");
- }
- else if(_.isObject(error)) {
- showMessage(error.message, "icon-attention");
- }
- };
-
- var isOffline = false;
- function updateOnlineStatus() {
- if(isReady === false) {
- return;
- }
- $offlineStatusElt.toggleClass('hide', !isOffline);
- $extensionButtonsElt.toggleClass('hide', isOffline);
- }
- notifications.onOfflineChanged = function(isOfflineParam) {
- isOffline = isOfflineParam;
- updateOnlineStatus();
- if(isOffline === true) {
- showMessage("You are offline.", "icon-attention-circled msg-offline");
- }
- else {
- showMessage("You are back online!", "icon-signal");
- }
- };
-
- notifications.onSyncImportSuccess = function(fileDescList, provider) {
- var titles = _.map(fileDescList, function(fileDesc) {
- return fileDesc.title;
- }).join(", ");
- showMessage(titles + ' imported successfully from ' + provider.providerName + '.');
- };
-
- notifications.onSyncExportSuccess = function(fileDesc, syncAttributes) {
- showMessage('"' + fileDesc.title + '" will now be synchronized on ' + syncAttributes.provider.providerName + '.');
- };
-
- notifications.onSyncRemoved = function(fileDesc, syncAttributes) {
- showMessage(syncAttributes.provider.providerName + " synchronized location has been removed.");
- };
-
- notifications.onPublishSuccess = function(fileDesc) {
- showMessage('"' + fileDesc.title + '" successfully published.');
- };
-
- notifications.onNewPublishSuccess = function(fileDesc, publishAttributes) {
- showMessage('"' + fileDesc.title + '" is now published on ' + publishAttributes.provider.providerName + '.');
- };
-
- notifications.onPublishRemoved = function(fileDesc, publishAttributes) {
- showMessage(publishAttributes.provider.providerName + " publish location has been removed.");
- };
-
- return notifications;
-});
-define('text!html/umlDiagramsSettingsBlock.html',[],function () { return 'Creates UML diagrams from plain text description.
\n\n\n \nSequence diagrams:
\n```sequence\nAlice->Bob: Hello Bob, how are you?\nBob-->Alice: I am good thanks!\n```
\n \n\nFlow charts:
\n```flow\nst=>start: Start\ne=>end\nop=>operation: My Operation\ncond=>condition: Yes or No?\nst->op->cond\ncond(yes)->e\ncond(no)->op\n```
\n \n\n Note: Markdown Extra extension has to be enabled with GFM fenced code blocks option.
\n \n';});
-
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël 2.1.1 - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
@@ -29167,14 +24847,14 @@ define('extensions/umlDiagrams',[
"utils",
"logger",
"classes/Extension",
- "text!html/umlDiagramsSettingsBlock.html",
+ // "ext!html/umlDiagramsSettingsBlock.html",
'crel',
'Diagram',
'flow-chart'
-], function(_, utils, logger, Extension, umlDiagramsSettingsBlockHTML, crel, Diagram, flowChart) {
+], function(_, utils, logger, Extension, crel, Diagram, flowChart) {
var umlDiagrams = new Extension("umlDiagrams", "UML Diagrams", true);
- umlDiagrams.settingsBlock = umlDiagramsSettingsBlockHTML;
+ // umlDiagrams.settingsBlock = umlDiagramsSettingsBlockHTML;
umlDiagrams.defaultConfig = {
flowchartOptions: [
'{',
@@ -29185,13 +24865,13 @@ define('extensions/umlDiagrams',[
].join('\n')
};
- umlDiagrams.onLoadSettings = function() {
- utils.setInputValue("#textarea-umldiagram-flowchart-options", umlDiagrams.config.flowchartOptions);
- };
+ // umlDiagrams.onLoadSettings = function() {
+ // utils.setInputValue("#textarea-umldiagram-flowchart-options", umlDiagrams.config.flowchartOptions);
+ // };
- umlDiagrams.onSaveSettings = function(newConfig, event) {
- newConfig.flowchartOptions = utils.getInputJSONValue("#textarea-umldiagram-flowchart-options", event);
- };
+ // umlDiagrams.onSaveSettings = function(newConfig, event) {
+ // newConfig.flowchartOptions = utils.getInputJSONValue("#textarea-umldiagram-flowchart-options", event);
+ // };
umlDiagrams.onPagedownConfigure = function(editor) {
var previewContentsElt = document.getElementById('preview-contents');
@@ -29230,35 +24910,33 @@ define('extensions/umlDiagrams',[
return umlDiagrams;
});
-define('text!html/tocSettingsBlock.html',[],function () { return 'Generates a table of contents when a [TOC] marker is found.
\n';});
-
define('extensions/toc',[
// "jquery",
"underscore",
"utils",
"classes/Extension",
- "text!html/tocSettingsBlock.html",
-], function(_, utils, Extension, tocSettingsBlockHTML) {
+ // "ext!html/tocSettingsBlock.html",
+], function(_, utils, Extension) {
var toc = new Extension("toc", "Table of Contents", true);
- toc.settingsBlock = tocSettingsBlockHTML;
+ // toc.settingsBlock = tocSettingsBlockHTML;
toc.defaultConfig = {
marker: "\\[(TOC|toc)\\]",
maxDepth: 6,
button: true,
};
- toc.onLoadSettings = function() {
- utils.setInputValue("#input-toc-marker", toc.config.marker);
- utils.setInputValue("#input-toc-maxdepth", toc.config.maxDepth);
- utils.setInputChecked("#input-toc-button", toc.config.button);
- };
+ // toc.onLoadSettings = function() {
+ // utils.setInputValue("#input-toc-marker", toc.config.marker);
+ // utils.setInputValue("#input-toc-maxdepth", toc.config.maxDepth);
+ // utils.setInputChecked("#input-toc-button", toc.config.button);
+ // };
- toc.onSaveSettings = function(newConfig, event) {
- newConfig.marker = utils.getInputRegExpValue("#input-toc-marker", event);
- newConfig.maxDepth = utils.getInputIntValue("#input-toc-maxdepth");
- newConfig.button = utils.getInputChecked("#input-toc-button");
- };
+ // toc.onSaveSettings = function(newConfig, event) {
+ // newConfig.marker = utils.getInputRegExpValue("#input-toc-marker", event);
+ // newConfig.maxDepth = utils.getInputIntValue("#input-toc-maxdepth");
+ // newConfig.button = utils.getInputChecked("#input-toc-button");
+ // };
/*
toc.onCreatePreviewButton = function() {
@@ -29407,7 +25085,7 @@ define('extensions/emailConverter',[
], function(Extension) {
var emailConverter = new Extension("emailConverter", "Markdown Email", true);
- emailConverter.settingsBlock = 'Converts email addresses in the form <email@example.com> into clickable links.
';
+ // emailConverter.settingsBlock = 'Converts email addresses in the form <email@example.com> into clickable links.
';
emailConverter.onPagedownConfigure = function(editor) {
editor.getConverter().hooks.chain("postConversion", function(text) {
@@ -29420,17 +25098,15 @@ define('extensions/emailConverter',[
return emailConverter;
});
-define('text!html/scrollSyncSettingsBlock.html',[],function () { return 'Binds together editor and preview scrollbars.
\n\n\tNote: The mapping between Markdown and HTML is based on the\n\tposition of the title elements (h1, h2...) in the page. Therefore if\n\tyour document does not contain any title, the mapping will be linear and\n\tconsequently less accurate.
\n ';});
-
define('extensions/scrollSync',[
// "jquery",
"underscore",
- "classes/Extension",
- "text!html/scrollSyncSettingsBlock.html"
-], function(_, Extension, scrollSyncSettingsBlockHTML) {
+ "classes/Extension"
+ // "ext!html/scrollSyncSettingsBlock.html"
+], function(_, Extension) {
var scrollSync = new Extension("scrollSync", "Scroll Sync", true, true);
- scrollSync.settingsBlock = scrollSyncSettingsBlockHTML;
+ // scrollSync.settingsBlock = scrollSyncSettingsBlockHTML;
var sectionList;
scrollSync.onSectionsCreated = function(sectionListParam) {
@@ -29443,17 +25119,28 @@ define('extensions/scrollSync',[
var htmlSectionList = [];
var lastEditorScrollTop;
var lastPreviewScrollTop;
+
+ // 创建sections
+ // mdSectionList 和 htmlSectionList
+ // 两者一一对应, 知道各自offsetTop
var buildSections = _.debounce(function() {
+ // 编辑区
mdSectionList = [];
var mdSectionOffset;
var scrollHeight;
+
_.each(editorElt.querySelectorAll(".wmd-input-section"), function(delimiterElt) {
if(mdSectionOffset === undefined) {
// Force start to 0 for the first section
mdSectionOffset = 0;
return;
}
- delimiterElt = delimiterElt.firstChild;
+ // life
+ // 因为如果左侧是纯文本编辑, delimiterElt.firstChild就是文本
+ if (delimiterElt.firstChild && delimiterElt.firstChild.nodeName != '#text') {
+ delimiterElt = delimiterElt.firstChild;
+ }
+
// Consider div scroll position
var newSectionOffset = delimiterElt.offsetTop;
mdSectionList.push({
@@ -29463,6 +25150,7 @@ define('extensions/scrollSync',[
});
mdSectionOffset = newSectionOffset;
});
+
// Last section
scrollHeight = editorElt.scrollHeight;
mdSectionList.push({
@@ -29471,6 +25159,7 @@ define('extensions/scrollSync',[
height: scrollHeight - mdSectionOffset
});
+ // 预览区相对应
// Find corresponding sections in the preview
htmlSectionList = [];
var htmlSectionOffset;
@@ -29556,10 +25245,14 @@ define('extensions/scrollSync',[
tick();
}
+ // 同步预览
var doScrollSync = _.throttle(function() {
- if(!isPreviewVisible || mdSectionList.length === 0 || mdSectionList.length !== htmlSectionList.length) {
+ if(!isPreviewVisible
+ || mdSectionList.length === 0
+ || mdSectionList.length !== htmlSectionList.length) {
return;
}
+
var editorScrollTop = editorElt.scrollTop;
editorScrollTop < 0 && (editorScrollTop = 0);
var previewScrollTop = previewElt.scrollTop;
@@ -29628,7 +25321,6 @@ define('extensions/scrollSync',[
scrollSync.onReady = function() {
previewElt = document.querySelector(".preview-container");
editorElt = document.querySelector("#wmd-input");
-
$(previewElt).scroll(function() {
if(isPreviewMoving === false && scrollAdjust === false) {
isScrollPreview = true;
@@ -29693,27 +25385,19 @@ define('extensions/scrollSync',[
return scrollSync;
});
-define('text!extensions/shortcutsDefaultMapping.settings',[],function () { return '{\n \'mod+b\': bindPagedownButton(\'bold\'),\n \'mod+i\': bindPagedownButton(\'italic\'),\n \'mod+l\': bindPagedownButton(\'link\'),\n \'mod+q\': bindPagedownButton(\'quote\'),\n \'mod+k\': bindPagedownButton(\'code\'),\n \'mod+g\': bindPagedownButton(\'image\'),\n \'mod+o\': bindPagedownButton(\'olist\'),\n \'mod+u\': bindPagedownButton(\'ulist\'),\n \'mod+h\': bindPagedownButton(\'heading\'),\n \'mod+r\': bindPagedownButton(\'hr\'),\n \'mod+z\': bindPagedownButton(\'undo\'),\n \'mod+y\': bindPagedownButton(\'redo\'),\n \'mod+shift+z\': bindPagedownButton(\'redo\'),\n \'mod+m\': function(evt) {\n $(\'.button-open-discussion\').click();\n evt.preventDefault();\n },\n \'= = > space\': function() {\n expand(\'==> \', \'⇒ \');\n },\n \'< = = space\': function() {\n expand(\'<== \', \'⇐ \');\n },\n \'S t a c k E d i t\': function() {\n eventMgr.onMessage("You are stunned!!! Aren\'t you?");\n }\n}\n';});
-
-define('text!html/shortcutsSettingsBlock.html',[],function () { return 'Maps keyboard shortcuts to JavaScript functions.
\n\n';});
-
-define('text!html/tooltipSettingsShortcutsExtension.html',[],function () { return 'You can create expanding macros like this:\n \n \n\'- - > space\': function() {\n \n\texpand(\'--> \', \'→ \');\n \n}\n \n \nMore\n\tinfo \n \n \n Careful! This is subject to malicious code. Don\'t copy/paste untrusted content. \n';});
-
+// 什么原因会停止scroll或定位不准, 有resize的时候, offset都变了, 但是scrollSync插件里面的没变, 所以需要buildSection
+// 什么时候buildSections ?
+// scrollSync.onPreviewFinished, scrollSync.onLayoutResize
+;
define('extensions/shortcuts',[
// "jquery",
"underscore",
"utils",
"mousetrap",
- "classes/Extension",
- "text!extensions/shortcutsDefaultMapping.settings",
- "text!html/shortcutsSettingsBlock.html",
- "text!html/tooltipSettingsShortcutsExtension.html"
-], function(_, utils, mousetrap, Extension, shortcutsDefaultMapping, shortcutsSettingsBlockHTML, tooltipSettingsShortcutsExtensionHTML) {
-
+ "classes/Extension"
+], function(_, utils, mousetrap, Extension, shortcutsDefaultMapping) {
var shortcuts = new Extension("shortcuts", "Shortcuts", true, true);
- shortcuts.settingsBlock = shortcutsSettingsBlockHTML;
shortcuts.defaultConfig = {
- mapping: shortcutsDefaultMapping
};
var eventMgr;
@@ -29725,23 +25409,6 @@ define('extensions/shortcuts',[
});
};
- shortcuts.onLoadSettings = function() {
- utils.setInputValue("#textarea-shortcuts-mapping", shortcuts.config.mapping);
- };
-
- shortcuts.onSaveSettings = function(newConfig, event) {
- newConfig.code = utils.getInputValue("#textarea-shortcuts-mapping");
- try {
- /*jshint evil: true */
- eval('var test = ' + newConfig.code);
- }
- catch(e) {
- eventMgr.onError(e);
- // Mark the textarea as error
- utils.getInputTextValue("#textarea-shortcuts-mapping", event, /^$/);
- }
- };
-
/*jshint unused:false */
function bindPagedownButton(buttonName) {
return function(evt) {
@@ -29757,7 +25424,6 @@ define('extensions/shortcuts',[
}
/*
-
'mod+b': bindPagedownButton('bold'),
'mod+i': bindPagedownButton('italic'),
'mod+l': bindPagedownButton('link'),
@@ -29797,8 +25463,34 @@ define('extensions/shortcuts',[
};
var shortcutMap;
- /*jshint evil: true */
- eval('shortcutMap = ' + shortcuts.config.mapping);
+ var shortcutMap = {
+ 'mod+b': bindPagedownButton('bold'),
+ 'mod+i': bindPagedownButton('italic'),
+ 'mod+l': bindPagedownButton('link'),
+ 'mod+q': bindPagedownButton('quote'),
+ 'mod+k': bindPagedownButton('code'),
+ 'mod+g': bindPagedownButton('image'),
+ 'mod+o': bindPagedownButton('olist'),
+ 'mod+u': bindPagedownButton('ulist'),
+ 'mod+h': bindPagedownButton('heading'),
+ 'mod+r': bindPagedownButton('hr'),
+ 'mod+z': bindPagedownButton('undo'),
+ 'mod+y': bindPagedownButton('redo'),
+ 'mod+shift+z': bindPagedownButton('redo'),
+ 'mod+m': function(evt) {
+ $('.button-open-discussion').click();
+ evt.preventDefault();
+ },
+ '= = > space': function() {
+ expand('==> ', '⇒ ');
+ },
+ '< = = space': function() {
+ expand('<== ', '⇐ ');
+ },
+ 'S t a c k E d i t': function() {
+ eventMgr.onMessage("You are stunned!!! Aren't you?");
+ }
+ };
_.each(shortcutMap, function(func, shortcut) {
mousetrap.bind(shortcut, func);
});
@@ -29809,16 +25501,11 @@ define('extensions/shortcuts',[
};
shortcuts.onReady = function() {
- // utils.createTooltip(".tooltip-shortcuts-extension", tooltipSettingsShortcutsExtensionHTML);
};
return shortcuts;
});
-define('text!html/findReplace.html',[],function () { return '× \n\n\n
\n 0 found\n
\n
\n Search \n Replace \n All \n
\n
\n\n';});
-
-define('text!html/findReplaceSettingsBlock.html',[],function () { return 'Helps find and replace text in the current document.
\n';});
-
define('extensions/findReplace',[
// "jquery",
"underscore",
@@ -29827,23 +25514,25 @@ define('extensions/findReplace',[
"classes/Extension",
"mousetrap",
"rangy",
- "text!html/findReplace.html",
- "text!html/findReplaceSettingsBlock.html"
-], function(_, crel, utils, Extension, mousetrap, rangy, findReplaceHTML, findReplaceSettingsBlockHTML) {
+ // "ext!html/findReplace.html",
+ // "ext!html/findReplaceSettingsBlock.html"
+], function(_, crel, utils, Extension, mousetrap, rangy) {
+
+ var findReplaceHTML = '× \n\n\n
\n 0 found\n
\n
\n Search \n Replace \n All \n
\n
\n\n';
var findReplace = new Extension("findReplace", 'Find and Replace', true, true);
- findReplace.settingsBlock = findReplaceSettingsBlockHTML;
+ // findReplace.settingsBlock = findReplaceSettingsBlockHTML;
findReplace.defaultConfig = {
findReplaceShortcut: 'mod+f'
};
- findReplace.onLoadSettings = function() {
- utils.setInputValue("#input-find-replace-shortcut", findReplace.config.findReplaceShortcut);
- };
+ // findReplace.onLoadSettings = function() {
+ // utils.setInputValue("#input-find-replace-shortcut", findReplace.config.findReplaceShortcut);
+ // };
- findReplace.onSaveSettings = function(newConfig, event) {
- newConfig.findReplaceShortcut = utils.getInputTextValue("#input-find-replace-shortcut", event);
- };
+ // findReplace.onSaveSettings = function(newConfig, event) {
+ // newConfig.findReplaceShortcut = utils.getInputTextValue("#input-find-replace-shortcut", event);
+ // };
var editor;
findReplace.onEditorCreated = function(editorParam) {
@@ -30084,19 +25773,17 @@ define('extensions/findReplace',[
return findReplace;
});
-define('text!html/htmlSanitizerSettingsBlock.html',[],function () { return 'Prevents cross-site-scripting attacks (XSS).
\n Careful: Disable at your own risk!
\n';});
-
define('extensions/htmlSanitizer',[
// "jquery",
"underscore",
"utils",
"logger",
"classes/Extension",
- "text!html/htmlSanitizerSettingsBlock.html"
-], function(_, utils, logger, Extension, htmlSanitizerSettingsBlockHTML) {
+ // "ext!html/htmlSanitizerSettingsBlock.html"
+], function(_, utils, logger, Extension) {
var htmlSanitizer = new Extension("htmlSanitizer", "HTML Sanitizer", true);
- htmlSanitizer.settingsBlock = htmlSanitizerSettingsBlockHTML;
+ // htmlSanitizer.settingsBlock = htmlSanitizerSettingsBlockHTML;
var buf;
htmlSanitizer.onPagedownConfigure = function(editor) {
@@ -30642,7 +26329,7 @@ define('eventMgr',[
"logger",
"classes/Extension",
"settings",
- "extensions/yamlFrontMatterParser",
+ // "extensions/yamlFrontMatterParser",
"extensions/markdownSectionParser",
"extensions/partialRendering",
// "extensions/buttonMarkdownSyntax",
@@ -30657,8 +26344,8 @@ define('eventMgr',[
// "extensions/documentSelector",
// "extensions/documentPanel",
// "extensions/documentManager",
- "extensions/workingIndicator",
- "extensions/notifications",
+ // "extensions/workingIndicator",
+ // "extensions/notifications",
"extensions/umlDiagrams",
"extensions/markdownExtra",
"extensions/toc",
@@ -30854,6 +26541,7 @@ define('eventMgr',[
addEventHook("onTweet");
+ // onPreviewFinished 触发 scrollSync
var onPreviewFinished = createEventHook("onPreviewFinished");
var onAsyncPreviewListenerList = getExtensionListenerList("onAsyncPreview");
var previewContentsElt;
@@ -30877,6 +26565,8 @@ define('eventMgr',[
});
}
+ // recursiveCall(onAsyncPreviewListenerList);
+ // 加载图片后才会触发onPreviewFinished, 因为offsetTop()会有影响, 所以, 必须要在图片加载完成才触发
recursiveCall(onAsyncPreviewListenerList.concat([
function(callback) {
// We assume some images are loading asynchronously after the preview
@@ -30959,6 +26649,7 @@ define('eventMgr',[
return eventMgr;
});
+
/**
* Prism: Lightweight, robust, elegant syntax highlighting
* MIT license http://www.opensource.org/licenses/mit-license.php/
@@ -31134,6 +26825,7 @@ var _ = self.Prism = {
}
},
+ // 这里啊, 把一堆好好的文本替换成恶心的东西
highlight: function (text, grammar, language) {
return Token.stringify(_.tokenize(text, grammar), language);
},
@@ -31278,9 +26970,8 @@ Token.stringify = function(o, language, parent) {
for (var name in env.attributes) {
attributes += name + '="' + (env.attributes[name] || '') + '"';
}
-
+
return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '' + env.tag + '>';
-
};
if (!self.document) {
@@ -33519,1243 +29210,6 @@ define("diff_match_patch_uncompressed", (function (global) {
};
}(this)));
-!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define('jsondiffpatch',e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jsondiffpatch=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0) {
- var fn = queue.shift();
- fn();
- }
- }
- }, true);
-
- return function nextTick(fn) {
- queue.push(fn);
- window.postMessage('process-tick', '*');
- };
- }
-
- return function nextTick(fn) {
- setTimeout(fn, 0);
- };
-})();
-
-process.title = 'browser';
-process.browser = true;
-process.env = {};
-process.argv = [];
-
-process.binding = function (name) {
- throw new Error('process.binding is not supported');
-}
-
-// TODO(shtylman)
-process.cwd = function () { return '/' };
-process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
-};
-
-},{}],2:[function(_dereq_,module,exports){
-
-var Pipe = _dereq_('../pipe').Pipe;
-
-var Context = function Context(){
-};
-
-Context.prototype.setResult = function(result) {
- this.result = result;
- this.hasResult = true;
- return this;
-};
-
-Context.prototype.exit = function() {
- this.exiting = true;
- return this;
-};
-
-Context.prototype.switchTo = function(next, pipe) {
- if (typeof next === 'string' || next instanceof Pipe) {
- this.nextPipe = next;
- } else {
- this.next = next;
- if (pipe) {
- this.nextPipe = pipe;
- }
- }
- return this;
-};
-
-Context.prototype.push = function(child, name) {
- child.parent = this;
- if (typeof name !== 'undefined') {
- child.childName = name;
- }
- child.root = this.root || this;
- child.options = child.options || this.options;
- if (!this.children) {
- this.children = [child];
- this.nextAfterChildren = this.next || null;
- this.next = child;
- } else {
- this.children[this.children.length - 1].next = child;
- this.children.push(child);
- }
- child.next = this;
- return this;
-};
-
-exports.Context = Context;
-},{"../pipe":15}],3:[function(_dereq_,module,exports){
-
-var Context = _dereq_('./context').Context;
-
-var DiffContext = function DiffContext(left, right){
- this.left = left;
- this.right = right;
- this.pipe = 'diff';
-};
-
-DiffContext.prototype = new Context();
-
-exports.DiffContext = DiffContext;
-},{"./context":2}],4:[function(_dereq_,module,exports){
-
-var Context = _dereq_('./context').Context;
-
-var PatchContext = function PatchContext(left, delta){
- this.left = left;
- this.delta = delta;
- this.pipe = 'patch';
-};
-
-PatchContext.prototype = new Context();
-
-exports.PatchContext = PatchContext;
-},{"./context":2}],5:[function(_dereq_,module,exports){
-
-var Context = _dereq_('./context').Context;
-
-var ReverseContext = function ReverseContext(delta){
- this.delta = delta;
- this.pipe = 'reverse';
-};
-
-ReverseContext.prototype = new Context();
-
-exports.ReverseContext = ReverseContext;
-},{"./context":2}],6:[function(_dereq_,module,exports){
-
-// use as 2nd parameter for JSON.parse to revive Date instances
-module.exports = function dateReviver(key, value) {
- var a;
- if (typeof value === 'string') {
- a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(Z|([+\-])(\d{2}):(\d{2}))$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6]));
- }
- }
- return value;
-};
-},{}],7:[function(_dereq_,module,exports){
-
-var Processor = _dereq_('./processor').Processor;
-var Pipe = _dereq_('./pipe').Pipe;
-var DiffContext = _dereq_('./contexts/diff').DiffContext;
-var PatchContext = _dereq_('./contexts/patch').PatchContext;
-var ReverseContext = _dereq_('./contexts/reverse').ReverseContext;
-
-var trivial = _dereq_('./filters/trivial');
-var nested = _dereq_('./filters/nested');
-var arrays = _dereq_('./filters/arrays');
-var dates = _dereq_('./filters/dates');
-var texts = _dereq_('./filters/texts');
-
-var DiffPatcher = function DiffPatcher(options){
- this.processor = new Processor(options);
- this.processor.pipe(new Pipe('diff').append(
- nested.collectChildrenDiffFilter,
- trivial.diffFilter,
- dates.diffFilter,
- texts.diffFilter,
- nested.objectsDiffFilter,
- arrays.diffFilter
- ).shouldHaveResult());
- this.processor.pipe(new Pipe('patch').append(
- nested.collectChildrenPatchFilter,
- arrays.collectChildrenPatchFilter,
- trivial.patchFilter,
- texts.patchFilter,
- nested.patchFilter,
- arrays.patchFilter
- ).shouldHaveResult());
- this.processor.pipe(new Pipe('reverse').append(
- nested.collectChildrenReverseFilter,
- arrays.collectChildrenReverseFilter,
- trivial.reverseFilter,
- texts.reverseFilter,
- nested.reverseFilter,
- arrays.reverseFilter
- ).shouldHaveResult());
-};
-
-DiffPatcher.prototype.options = function() {
- return this.processor.options.apply(this.processor, arguments);
-};
-
-DiffPatcher.prototype.diff = function(left, right) {
- return this.processor.process(new DiffContext(left, right));
-};
-
-DiffPatcher.prototype.patch = function(left, delta) {
- return this.processor.process(new PatchContext(left, delta));
-};
-
-DiffPatcher.prototype.reverse = function(delta) {
- return this.processor.process(new ReverseContext(delta));
-};
-
-DiffPatcher.prototype.unpatch = function(right, delta) {
- return this.patch(right, this.reverse(delta));
-};
-
-exports.DiffPatcher = DiffPatcher;
-
-},{"./contexts/diff":3,"./contexts/patch":4,"./contexts/reverse":5,"./filters/arrays":9,"./filters/dates":10,"./filters/nested":12,"./filters/texts":13,"./filters/trivial":14,"./pipe":15,"./processor":16}],8:[function(_dereq_,module,exports){
-(function (process){
-
-var DiffPatcher = _dereq_('./diffpatcher').DiffPatcher;
-exports.DiffPatcher = DiffPatcher;
-
-exports.create = function(options){
- return new DiffPatcher(options);
-};
-
-exports.dateReviver = _dereq_('./date-reviver');
-
-var defaultInstance;
-
-exports.diff = function() {
- if (!defaultInstance) {
- defaultInstance = new DiffPatcher();
- }
- return defaultInstance.diff.apply(defaultInstance, arguments);
-};
-
-exports.patch = function() {
- if (!defaultInstance) {
- defaultInstance = new DiffPatcher();
- }
- return defaultInstance.patch.apply(defaultInstance, arguments);
-};
-
-exports.unpatch = function() {
- if (!defaultInstance) {
- defaultInstance = new DiffPatcher();
- }
- return defaultInstance.unpatch.apply(defaultInstance, arguments);
-};
-
-exports.reverse = function() {
- if (!defaultInstance) {
- defaultInstance = new DiffPatcher();
- }
- return defaultInstance.reverse.apply(defaultInstance, arguments);
-};
-
-var inNode = typeof process !== 'undefined' && typeof process.execPath === 'string';
-if (inNode) {
- var formatters = _dereq_('./formatters' + '/index');
- exports.formatters = formatters;
- // shortcut for console
- exports.console = formatters.console;
-} else {
- exports.homepage = 'https://github.com/benjamine/jsondiffpatch';
- exports.version = '0.1.5';
-}
-
-}).call(this,_dereq_("/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
-},{"./date-reviver":6,"./diffpatcher":7,"/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":1}],9:[function(_dereq_,module,exports){
-
-var DiffContext = _dereq_('../contexts/diff').DiffContext;
-var PatchContext = _dereq_('../contexts/patch').PatchContext;
-var ReverseContext = _dereq_('../contexts/reverse').ReverseContext;
-
-var lcs = _dereq_('./lcs');
-
-var ARRAY_MOVE = 3;
-
-var isArray = (typeof Array.isArray === 'function') ?
- // use native function
- Array.isArray :
- // use instanceof operator
- function(a) {
- return a instanceof Array;
- };
-
-var arrayIndexOf = typeof Array.prototype.indexOf === 'function' ?
- function(array, item) {
- return array.indexOf(item);
- } : function(array, item) {
- var length = array.length;
- for (var i = 0; i < length; i++) {
- if (array[i] === item) {
- return i;
- }
- }
- return -1;
- };
-
-var diffFilter = function arraysDiffFilter(context){
- if (!context.leftIsArray) { return; }
-
- var objectHash = context.options && context.options.objectHash;
-
- var match = function(array1, array2, index1, index2, context) {
- var value1 = array1[index1];
- var value2 = array2[index2];
- if (value1 === value2) {
- return true;
- }
- if (typeof value1 !== 'object' || typeof value2 !== 'object') {
- return false;
- }
- if (!objectHash) { return false; }
- var hash1, hash2;
- if (typeof index1 === 'number') {
- context.hashCache1 = context.hashCache1 || [];
- hash1 = context.hashCache1[index1];
- if (typeof hash1 === 'undefined') {
- context.hashCache1[index1] = hash1 = objectHash(value1, index1);
- }
- } else {
- hash1 = objectHash(value1);
- }
- if (typeof hash1 === 'undefined') {
- return false;
- }
- if (typeof index2 === 'number') {
- context.hashCache2 = context.hashCache2 || [];
- hash2 = context.hashCache2[index2];
- if (typeof hash2 === 'undefined') {
- context.hashCache2[index2] = hash2 = objectHash(value2, index2);
- }
- } else {
- hash2 = objectHash(value2);
- }
- if (typeof hash2 === 'undefined') {
- return false;
- }
- return hash1 === hash2;
- };
-
- var matchContext = {};
- var commonHead = 0, commonTail = 0, index, index1, index2;
- var array1 = context.left;
- var array2 = context.right;
- var len1 = array1.length;
- var len2 = array2.length;
-
- var child;
-
- // separate common head
- while (commonHead < len1 && commonHead < len2 &&
- match(array1, array2, commonHead, commonHead, matchContext)) {
- index = commonHead;
- child = new DiffContext(context.left[index], context.right[index]);
- context.push(child, index);
- commonHead++;
- }
- // separate common tail
- while (commonTail + commonHead < len1 && commonTail + commonHead < len2 &&
- match(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {
- index1 = len1 - 1 - commonTail;
- index2 = len2 - 1 - commonTail;
- child = new DiffContext(context.left[index1], context.right[index2]);
- context.push(child, index2);
- commonTail++;
- }
- var result;
- if (commonHead + commonTail === len1) {
- if (len1 === len2) {
- // arrays are identical
- context.setResult(undefined).exit();
- return;
- }
- // trivial case, a block (1 or more consecutive items) was added
- result = result || { _t: 'a' };
- for (index = commonHead; index < len2 - commonTail; index++) {
- result[index] = [array2[index]];
- }
- context.setResult(result).exit();
- return;
- }
- if (commonHead + commonTail === len2) {
- // trivial case, a block (1 or more consecutive items) was removed
- result = result || { _t: 'a' };
- for (index = commonHead; index < len1 - commonTail; index++) {
- result['_'+index] = [array1[index], 0, 0];
- }
- context.setResult(result).exit();
- return;
- }
- // reset hash cache
- matchContext = {};
- // diff is not trivial, find the LCS (Longest Common Subsequence)
- var trimmed1 = array1.slice(commonHead, len1 - commonTail);
- var trimmed2 = array2.slice(commonHead, len2 - commonTail);
- var seq = lcs.get(
- trimmed1, trimmed2,
- match,
- matchContext
- );
- var removedItems = [];
- result = result || { _t: 'a' };
- for (index = commonHead; index < len1 - commonTail; index++) {
- if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {
- // removed
- result['_'+index] = [array1[index], 0, 0];
- removedItems.push(index);
- }
- }
-
- var detectMove = true;
- if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {
- detectMove = false;
- }
- var includeValueOnMove = false;
- if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {
- includeValueOnMove = true;
- }
-
- var removedItemsLength = removedItems.length;
- for (index = commonHead; index < len2 - commonTail; index++) {
- var indexOnArray2 = arrayIndexOf(seq.indices2, index - commonHead);
- if (indexOnArray2 < 0) {
- // added, try to match with a removed item and register as position move
- var isMove = false;
- if (detectMove && removedItemsLength > 0) {
- for (index1 = 0; index1 < removedItemsLength; index1++) {
- if (match(trimmed1, trimmed2, removedItems[index1] - commonHead,
- index - commonHead, matchContext)) {
- // store position move as: [originalValue, newPosition, ARRAY_MOVE]
- result['_' + removedItems[index1]].splice(1, 2, index, ARRAY_MOVE);
- if (!includeValueOnMove) {
- // don't include moved value on diff, to save bytes
- result['_' + removedItems[index1]][0] = '';
- }
-
- index1 = removedItems[index1];
- index2 = index;
- child = new DiffContext(context.left[index1], context.right[index2]);
- context.push(child, index2);
- removedItems.splice(index1, 1);
- isMove = true;
- break;
- }
- }
- }
- if (!isMove) {
- // added
- result[index] = [array2[index]];
- }
- } else {
- // match, do inner diff
- index1 = seq.indices1[indexOnArray2] + commonHead;
- index2 = seq.indices2[indexOnArray2] + commonHead;
- child = new DiffContext(context.left[index1], context.right[index2]);
- context.push(child, index2);
- }
- }
-
- context.setResult(result).exit();
-
-};
-diffFilter.filterName = 'arrays';
-
-var compare = {
- numerically: function(a, b) {
- return a - b;
- },
- numericallyBy: function(name) {
- return function(a, b) {
- return a[name] - b[name];
- };
- }
-};
-
-var patchFilter = function nestedPatchFilter(context) {
- if (!context.nested) { return; }
- if (context.delta._t !== 'a') { return; }
- var index, index1;
-
- var delta = context.delta;
- var array = context.left;
-
- // first, separate removals, insertions and modifications
- var toRemove = [];
- var toInsert = [];
- var toModify = [];
- for (index in delta) {
- if (index !== '_t') {
- if (index[0] === '_') {
- // removed item from original array
- if (delta[index][2] === 0 || delta[index][2] === ARRAY_MOVE) {
- toRemove.push(parseInt(index.slice(1), 10));
- } else {
- throw new Error('only removal or move can be applied at original array indices' +
- ', invalid diff type: ' + delta[index][2]);
- }
- } else {
- if (delta[index].length === 1) {
- // added item at new array
- toInsert.push({
- index: parseInt(index, 10),
- value: delta[index][0]
- });
- } else {
- // modified item at new array
- toModify.push({
- index: parseInt(index, 10),
- delta: delta[index]
- });
- }
- }
- }
- }
-
- // remove items, in reverse order to avoid sawing our own floor
- toRemove = toRemove.sort(compare.numerically);
- for (index = toRemove.length - 1; index >= 0; index--) {
- index1 = toRemove[index];
- var indexDiff = delta['_' + index1];
- var removedValue = array.splice(index1, 1)[0];
- if (indexDiff[2] === ARRAY_MOVE) {
- // reinsert later
- toInsert.push({
- index: indexDiff[1],
- value: removedValue
- });
- }
- }
-
- // insert items, in reverse order to avoid moving our own floor
- toInsert = toInsert.sort(compare.numericallyBy('index'));
- var toInsertLength = toInsert.length;
- for (index = 0; index < toInsertLength; index++) {
- var insertion = toInsert[index];
- array.splice(insertion.index, 0, insertion.value);
- }
-
- // apply modifications
- var toModifyLength = toModify.length;
- var child;
- if (toModifyLength > 0) {
- for (index = 0; index < toModifyLength; index++) {
- var modification = toModify[index];
- child = new PatchContext(context.left[modification.index], modification.delta);
- context.push(child, modification.index);
- }
- }
-
- if (!context.children) {
- context.setResult(context.left).exit();
- return;
- }
- context.exit();
-};
-patchFilter.filterName = 'arrays';
-
-var collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {
- if (!context || !context.children) { return; }
- if (context.delta._t !== 'a') { return; }
- var length = context.children.length;
- var child;
- for (var index = 0; index < length; index++) {
- child = context.children[index];
- context.left[child.childName] = child.result;
- }
- context.setResult(context.left).exit();
-};
-collectChildrenPatchFilter.filterName = 'arraysCollectChildren';
-
-var reverseFilter = function arraysReverseFilter(context) {
- if (!context.nested) {
- if (context.delta[2] === ARRAY_MOVE) {
- context.newName = '_' + context.delta[1];
- context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();
- }
- return;
- }
- if (context.delta._t !== 'a') { return; }
- var name, child;
- for (name in context.delta) {
- if (name === '_t') { continue; }
- child = new ReverseContext(context.delta[name]);
- context.push(child, name);
- }
- context.exit();
-};
-reverseFilter.filterName = 'arrays';
-
-var reverseArrayDeltaIndex = function(delta, index, itemDelta) {
- var newIndex = index;
- if (typeof index === 'string' && index[0] === '_') {
- newIndex = parseInt(index.substr(1), 10);
- } else {
- var uindex = '_' + index;
- if (isArray(itemDelta) && itemDelta[2] === 0) {
- newIndex = uindex;
- } else {
- for (var index2 in delta) {
- var itemDelta2 = delta[index2];
- if (isArray(itemDelta2) && itemDelta2[2] === ARRAY_MOVE && itemDelta2[1].toString() === index) {
- newIndex = index2.substr(1);
- }
- }
- }
- }
- return newIndex;
-};
-
-var collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {
- if (!context || !context.children) { return; }
- if (context.delta._t !== 'a') { return; }
- var length = context.children.length;
- var child;
- var delta = { _t: 'a' };
- for (var index = 0; index < length; index++) {
- child = context.children[index];
- var name = child.newName;
- if (typeof name === 'undefined') {
- name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);
- }
- if (delta[name] !== child.result) {
- delta[name] = child.result;
- }
- }
- context.setResult(delta).exit();
-};
-collectChildrenReverseFilter.filterName = 'arraysCollectChildren';
-
-exports.diffFilter = diffFilter;
-exports.patchFilter = patchFilter;
-exports.collectChildrenPatchFilter = collectChildrenPatchFilter;
-exports.reverseFilter = reverseFilter;
-exports.collectChildrenReverseFilter = collectChildrenReverseFilter;
-},{"../contexts/diff":3,"../contexts/patch":4,"../contexts/reverse":5,"./lcs":11}],10:[function(_dereq_,module,exports){
-var diffFilter = function datesDiffFilter(context) {
- if (context.left instanceof Date) {
- if (context.right instanceof Date) {
- if (context.left.getTime() !== context.right.getTime()) {
- context.setResult([context.left, context.right]);
- } else {
- context.setResult(undefined);
- }
- } else {
- context.setResult([context.left, context.right]);
- }
- context.exit();
- } else if (context.right instanceof Date) {
- context.setResult([context.left, context.right]).exit();
- }
-};
-diffFilter.filterName = 'dates';
-
-exports.diffFilter = diffFilter;
-},{}],11:[function(_dereq_,module,exports){
-/*
-
-LCS implementation that supports arrays or strings
-
-reference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
-
-*/
-
-var defaultMatch = function(array1, array2, index1, index2) {
- return array1[index1] === array2[index2];
-};
-
-var lengthMatrix = function(array1, array2, match, context) {
- var len1 = array1.length;
- var len2 = array2.length;
- var x, y;
-
- // initialize empty matrix of len1+1 x len2+1
- var matrix = [len1 + 1];
- for (x = 0; x < len1 + 1; x++) {
- matrix[x] = [len2 + 1];
- for (y = 0; y < len2 + 1; y++) {
- matrix[x][y] = 0;
- }
- }
- matrix.match = match;
- // save sequence lengths for each coordinate
- for (x = 1; x < len1 + 1; x++) {
- for (y = 1; y < len2 + 1; y++) {
- if (match(array1, array2, x - 1, y - 1, context)) {
- matrix[x][y] = matrix[x - 1][y - 1] + 1;
- } else {
- matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);
- }
- }
- }
- return matrix;
-};
-
-var backtrack = function(matrix, array1, array2, index1, index2, context) {
- if (index1 === 0 || index2 === 0) {
- return {
- sequence: [],
- indices1: [],
- indices2: []
- };
- }
-
- if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {
- var subsequence = backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context);
- subsequence.sequence.push(array1[index1 - 1]);
- subsequence.indices1.push(index1 - 1);
- subsequence.indices2.push(index2 - 1);
- return subsequence;
- }
-
- if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {
- return backtrack(matrix, array1, array2, index1, index2 - 1, context);
- } else {
- return backtrack(matrix, array1, array2, index1 - 1, index2, context);
- }
-};
-
-var get = function(array1, array2, match, context) {
- context = context || {};
- var matrix = lengthMatrix(array1, array2, match || defaultMatch, context);
- var result = backtrack(matrix, array1, array2, array1.length, array2.length, context);
- if (typeof array1 === 'string' && typeof array2 === 'string') {
- result.sequence = result.sequence.join('');
- }
- return result;
-};
-
-exports.get = get;
-
-},{}],12:[function(_dereq_,module,exports){
-
-var DiffContext = _dereq_('../contexts/diff').DiffContext;
-var PatchContext = _dereq_('../contexts/patch').PatchContext;
-var ReverseContext = _dereq_('../contexts/reverse').ReverseContext;
-
-var collectChildrenDiffFilter = function collectChildrenDiffFilter(context) {
- if (!context || !context.children) { return; }
- var length = context.children.length;
- var child;
- var result = context.result;
- for (var index = 0; index < length; index++) {
- child = context.children[index];
- if (typeof child.result === 'undefined') {
- continue;
- }
- result = result || {};
- result[child.childName] = child.result;
- }
- if (result && context.leftIsArray) {
- result._t = 'a';
- }
- context.setResult(result).exit();
-};
-collectChildrenDiffFilter.filterName = 'collectChildren';
-
-var objectsDiffFilter = function objectsDiffFilter(context) {
- if (context.leftIsArray || context.leftType !== 'object') { return; }
-
- var name, child;
- for (name in context.left) {
- child = new DiffContext(context.left[name], context.right[name]);
- context.push(child, name);
- }
- for (name in context.right) {
- if (typeof context.left[name] === 'undefined') {
- child = new DiffContext(undefined, context.right[name]);
- context.push(child, name);
- }
- }
-
- if (!context.children || context.children.length === 0) {
- context.setResult(undefined).exit();
- return;
- }
- context.exit();
-};
-objectsDiffFilter.filterName = 'objects';
-
-var patchFilter = function nestedPatchFilter(context) {
- if (!context.nested) { return; }
- if (context.delta._t) { return; }
- var name, child;
- for (name in context.delta) {
- child = new PatchContext(context.left[name], context.delta[name]);
- context.push(child, name);
- }
- context.exit();
-};
-patchFilter.filterName = 'objects';
-
-var collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {
- if (!context || !context.children) { return; }
- if (context.delta._t) { return; }
- var length = context.children.length;
- var child;
- for (var index = 0; index < length; index++) {
- child = context.children[index];
- if (context.left[child.childName] !== child.result) {
- context.left[child.childName] = child.result;
- }
- }
- context.setResult(context.left).exit();
-};
-collectChildrenPatchFilter.filterName = 'collectChildren';
-
-var reverseFilter = function nestedReverseFilter(context) {
- if (!context.nested) { return; }
- if (context.delta._t) { return; }
- var name, child;
- for (name in context.delta) {
- child = new ReverseContext(context.delta[name]);
- context.push(child, name);
- }
- context.exit();
-};
-reverseFilter.filterName = 'objects';
-
-var collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {
- if (!context || !context.children) { return; }
- if (context.delta._t) { return; }
- var length = context.children.length;
- var child;
- var delta = {};
- for (var index = 0; index < length; index++) {
- child = context.children[index];
- if (delta[child.childName] !== child.result) {
- delta[child.childName] = child.result;
- }
- }
- context.setResult(delta).exit();
-};
-collectChildrenReverseFilter.filterName = 'collectChildren';
-
-exports.collectChildrenDiffFilter = collectChildrenDiffFilter;
-exports.objectsDiffFilter = objectsDiffFilter;
-exports.patchFilter = patchFilter;
-exports.collectChildrenPatchFilter = collectChildrenPatchFilter;
-exports.reverseFilter = reverseFilter;
-exports.collectChildrenReverseFilter = collectChildrenReverseFilter;
-},{"../contexts/diff":3,"../contexts/patch":4,"../contexts/reverse":5}],13:[function(_dereq_,module,exports){
-/* global diff_match_patch */
-var TEXT_DIFF = 2;
-var DEFAULT_MIN_LENGTH = 60;
-var cachedDiffPatch = null;
-
-var getDiffMatchPatch = function(){
- /*jshint camelcase: false */
-
- if (!cachedDiffPatch) {
- var instance;
- if (typeof diff_match_patch !== 'undefined') {
- // already loaded, probably a browser
- instance = new diff_match_patch();
- } else if (typeof _dereq_ === 'function') {
- var dmp = _dereq_('../../external/diff_match_patch_uncompressed');
- instance = new dmp.diff_match_patch();
- }
- if (!instance) {
- var error = new Error('text diff_match_patch library not found');
- error.diff_match_patch_not_found = true;
- throw error;
- }
- cachedDiffPatch = {
- diff: function(txt1, txt2){
- return instance.patch_toText(instance.patch_make(txt1, txt2));
- },
- patch: function(txt1, patch){
- var results = instance.patch_apply(instance.patch_fromText(patch), txt1);
- for (var i = 0; i < results[1].length; i++) {
- if (!results[1][i]) {
- var error = new Error('text patch failed');
- error.textPatchFailed = true;
- }
- }
- return results[0];
- }
- };
- }
- return cachedDiffPatch;
-};
-
-var diffFilter = function textsDiffFilter(context) {
- if (context.leftType !== 'string') { return; }
- var minLength = (context.options && context.options.textDiff &&
- context.options.textDiff.minLength) || DEFAULT_MIN_LENGTH;
- if (context.left.length < minLength ||
- context.right.length < minLength) {
- context.setResult([context.left, context.right]).exit();
- return;
- }
- // large text, use a text-diff algorithm
- var diff = getDiffMatchPatch().diff;
- context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();
-};
-diffFilter.filterName = 'texts';
-
-var patchFilter = function textsPatchFilter(context) {
- if (context.nested) { return; }
- if (context.delta[2] !== TEXT_DIFF) { return; }
-
- // text-diff, use a text-patch algorithm
- var patch = getDiffMatchPatch().patch;
- context.setResult(patch(context.left, context.delta[0])).exit();
-};
-patchFilter.filterName = 'texts';
-
-var textDeltaReverse = function(delta){
- var i, l, lines, line, lineTmp, header = null,
- headerRegex = /^@@ +\-(\d+),(\d+) +\+(\d+),(\d+) +@@$/,
- lineHeader, lineAdd, lineRemove;
- lines = delta.split('\n');
- for (i = 0, l = lines.length; i ' + isComposing);
+ // isComposing = 0;
+ // if(!isComposing) {
+ // 总执行这个
updateSectionList(newSectionList);
highlightSections();
- }
+ // }
if(fileChanged === true) {
// Refresh preview synchronously
pagedownEditor.refreshPreview();
@@ -35854,6 +30313,7 @@ define('editor',[
editor.watcher = watcher;
var diffMatchPatch = new diff_match_patch();
+ /*
var jsonDiffPatch = jsondiffpatch.create({
objectHash: function(obj) {
return JSON.stringify(obj);
@@ -35865,6 +30325,7 @@ define('editor',[
minLength: 9999999
}
});
+ */
function SelectionMgr() {
var self = this;
@@ -35925,7 +30386,9 @@ define('editor',[
}
offsetList = this.findOffsets(offsetList);
var startOffset = _.isObject(start) ? start : offsetList[startIndex];
+
range.setStart(startOffset.container, startOffset.offsetInContainer);
+
var endOffset = startOffset;
if(end && end != start) {
endOffset = _.isObject(end) ? end : offsetList[endIndex];
@@ -35933,10 +30396,21 @@ define('editor',[
range.setEnd(endOffset.container, endOffset.offsetInContainer);
return range;
};
+
+ // scroll 自动滚动
var adjustScroll;
var debouncedUpdateCursorCoordinates = utils.debounce(function() {
$inputElt.toggleClass('has-selection', this.selectionStart !== this.selectionEnd);
- var coordinates = this.getCoordinates(this.selectionEnd, this.selectionEndContainer, this.selectionEndOffset);
+ // console.log('auto scroll');
+
+ try {
+ var coordinates = this.getCoordinates(this.selectionEnd, this.selectionEndContainer, this.selectionEndOffset);
+ }
+ catch(e) {
+ console.error(e);
+ return;
+ }
+
if(this.cursorY !== coordinates.y) {
this.cursorY = coordinates.y;
eventMgr.onCursorCoordinates(coordinates.x, coordinates.y);
@@ -36360,6 +30834,7 @@ define('editor',[
selectionMgr.setSelectionStartEnd(selectionStart, selectionEnd);
selectionMgr.updateSelectionRange();
selectionMgr.updateCursorCoordinates(true);
+ /*
var discussionListJSON = fileDesc.discussionListJSON;
if(discussionListJSON != state.discussionListJSON) {
var oldDiscussionList = fileDesc.discussionList;
@@ -36380,6 +30855,7 @@ define('editor',[
});
commentsChanged && eventMgr.onCommentsChanged(fileDesc);
}
+ */
});
selectionStartBefore = selectionStart;
@@ -36478,15 +30954,17 @@ define('editor',[
undoMgr.currentMode = undoMgr.currentMode || 'typing';
var discussionList = _.values(fileDesc.discussionList);
fileDesc.newDiscussion && discussionList.push(fileDesc.newDiscussion);
- var updateDiscussionList = adjustCommentOffsets(textContent, newTextContent, discussionList);
+ // var updateDiscussionList = adjustCommentOffsets(textContent, newTextContent, discussionList);
textContent = newTextContent;
- if(updateDiscussionList === true) {
- fileDesc.discussionList = fileDesc.discussionList; // Write discussionList in localStorage
- }
+ // if(updateDiscussionList === true) {
+ // fileDesc.discussionList = fileDesc.discussionList; // Write discussionList in localStorage
+ // }
fileDesc.content = textContent;
selectionMgr.saveSelectionState();
eventMgr.onContentChanged(fileDesc, textContent);
- updateDiscussionList && eventMgr.onCommentsChanged(fileDesc);
+
+ // updateDiscussionList && eventMgr.onCommentsChanged(fileDesc);
+
undoMgr.saveState();
triggerSpellCheck();
}
@@ -36505,6 +30983,7 @@ define('editor',[
}
}
+ /*
function adjustCommentOffsets(oldTextContent, newTextContent, discussionList) {
if(!discussionList.length) {
return;
@@ -36553,6 +31032,8 @@ define('editor',[
}
editor.adjustCommentOffsets = adjustCommentOffsets;
+ *
+ */
// 入口
editor.init = function() {
@@ -36653,6 +31134,7 @@ define('editor',[
}
break;
case 13:
+ // console.log('newline');
action('newline');
evt.preventDefault();
break;
@@ -36661,13 +31143,20 @@ define('editor',[
clearNewline = false;
}
})
+ // 当浏览器有非直接的文字输入时, compositionstart事件会以同步模式触发.
.on('compositionstart', function() {
+ // console.trace('compositionstart !!!!!');
isComposing++;
})
- .on('compositionend', function() {
- setTimeout(function() {
+ // 当浏览器是直接的文字输入时, compositionend会以同步模式触发.
+ // 中文输入完成后, 比如按空格时触发
+ // 为什么要异步-- ?
+ .on('compositionend', function(e) {
+ // console.log('compositionend !!')
+ // console.log(e);
+ // setTimeout(function() {
isComposing--;
- }, 0);
+ // }, 0);
})
.on('mouseup', _.bind(selectionMgr.saveSelectionState, selectionMgr, true, false))
.on('paste', function(evt) {
@@ -36896,6 +31385,7 @@ define('editor',[
}
addTrailingLfNode();
selectionMgr.updateSelectionRange();
+ // console.trace('.updateCursorCoordinates')
selectionMgr.updateCursorCoordinates();
});
}
@@ -36925,15 +31415,19 @@ define('editor',[
// 实现编辑器下预览
function highlight(section) {
var text = escape(section.text);
+
if(!window.viewerMode) {
// log("pre")
// log(text);
// # lif
+ // 如果想以纯文本显示, 请注释之
text = Prism.highlight(text, Prism.languages.md);
// log('after');
// # lif
// log(text);
}
+
+ // 以下必须需要, 因为scrollSync需要wmd-input-section
var frontMatter = section.textWithFrontMatter.substring(0, section.textWithFrontMatter.length - section.text.length);
if(frontMatter.length) {
// Front matter highlighting
@@ -38460,7 +32954,6 @@ define('editor',[
}
function makeSpritedButtonRow() {
-
var buttonBar = panels.buttonBar;
var normalYShift = "0px";
@@ -38488,17 +32981,10 @@ define('editor',[
buttonRow.appendChild(button);
return button;
};
- var makeSpacer = function (num) {
- var spacer = document.createElement("li");
- spacer.className = "wmd-spacer wmd-spacer" + num;
- spacer.id = "wmd-spacer" + num + postfix;
- buttonRow.appendChild(spacer);
- xPosition += 25;
- }
buttons.bold = makeButton("wmd-bold-button", getString("bold"), "0px", bindCommand("doBold"));
buttons.italic = makeButton("wmd-italic-button", getString("italic"), "-20px", bindCommand("doItalic"));
- makeSpacer(1);
+ // makeSpacer(1);
buttons.link = makeButton("wmd-link-button", getString("link"), "-40px", bindCommand(function (chunk, postProcessing) {
return this.doLinkOrImage(chunk, postProcessing, false);
}));
@@ -38507,7 +32993,7 @@ define('editor',[
buttons.image = makeButton("wmd-image-button", getString("image"), "-100px", bindCommand(function (chunk, postProcessing) {
return this.doLinkOrImage(chunk, postProcessing, true);
}));
- makeSpacer(2);
+ // makeSpacer(2);
buttons.olist = makeButton("wmd-olist-button", getString("olist"), "-120px", bindCommand(function (chunk, postProcessing) {
this.doList(chunk, postProcessing, true);
}));
@@ -38516,7 +33002,7 @@ define('editor',[
}));
buttons.heading = makeButton("wmd-heading-button", getString("heading"), "-160px", bindCommand("doHeading"));
buttons.hr = makeButton("wmd-hr-button", getString("hr"), "-180px", bindCommand("doHorizontalRule"));
- makeSpacer(3);
+ // makeSpacer(3);
buttons.undo = makeButton("wmd-undo-button", getString("undo"), "-200px", null);
buttons.undo.execute = function (manager) { if (manager) manager.undo(); };
@@ -39307,13 +33793,13 @@ define('core',[
"crel",
"editor",
// "layout",
- "constants",
+ // "constants",
"utils",
- "storage",
+ // "storage",
"settings",
"eventMgr",
'pagedown'
-], function( _, crel, editor, constants, utils, storage, settings, eventMgr) {
+], function( _, crel, editor, utils, settings, eventMgr) {
var core = {};
@@ -39570,171 +34056,6 @@ define('core',[
return core;
});
-/*
- * Require-CSS RequireJS css! loader plugin
- * 0.1.2
- * Guy Bedford 2013
- * MIT
- */
-
-/*
- *
- * Usage:
- * require(['css!./mycssFile']);
- *
- * Tested and working in (up to latest versions as of March 2013):
- * Android
- * iOS 6
- * IE 6 - 10
- * Chome 3 - 26
- * Firefox 3.5 - 19
- * Opera 10 - 12
- *
- * browserling.com used for virtual testing environment
- *
- * Credit to B Cavalier & J Hann for the IE 6 - 9 method,
- * refined with help from Martin Cermak
- *
- * Sources that helped along the way:
- * - https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
- * - http://www.phpied.com/when-is-a-stylesheet-really-loaded/
- * - https://github.com/cujojs/curl/blob/master/src/curl/plugin/css.js
- *
- */
-
-define('css/css',[],function() {
- if (typeof window == 'undefined')
- return { load: function(n, r, load){ load() } };
-
- var head = document.getElementsByTagName('head')[0];
-
- var engine = window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/) || 0;
-
- // use