|
18 | 18 | * ========================================================== */ |
19 | 19 | (function(factory) { |
20 | 20 | if (typeof define === "function" && define.amd) { |
21 | | - //RequireJS |
| 21 | + // RequireJS |
22 | 22 | define(["jquery"], factory); |
23 | 23 | } else if (typeof exports === 'object') { |
24 | | - //Backbone.js |
| 24 | + // Backbone.js |
25 | 25 | factory(require('jquery')); |
26 | 26 | } else { |
27 | | - //Jquery plugin |
| 27 | + // jQuery plugin |
28 | 28 | factory(jQuery); |
29 | 29 | } |
30 | 30 | }(function($) { |
|
149 | 149 | callback.push(button.callback); |
150 | 150 | } |
151 | 151 |
|
152 | | - // Attach the button group into container dom |
| 152 | + // Attach the button group into container DOM |
153 | 153 | container.append(btnGroupContainer); |
154 | 154 | } |
155 | 155 | } |
|
282 | 282 | // iterate the additional button groups |
283 | 283 | $.each(options.additionalButtons[0], function(idx, buttonGroup) { |
284 | 284 |
|
285 | | - // see if the group name of the addional group matches an existing group |
| 285 | + // see if the group name of the additional group matches an existing group |
286 | 286 | var matchingGroups = $.grep(allBtnGroups, function(allButtonGroup, allIdx) { |
287 | 287 | return allButtonGroup.name === buttonGroup.name; |
288 | 288 | }); |
289 | 289 |
|
290 | | - // if it matches add the addional buttons to that group, if not just add it to the all buttons group |
| 290 | + // if it matches add the additional buttons to that group, if not just add it to the all buttons group |
291 | 291 | if (matchingGroups.length > 0) { |
292 | 292 | matchingGroups[0].data = matchingGroups[0].data.concat(buttonGroup.data); |
293 | 293 | } else { |
|
352 | 352 | editable.attrValues.push(this.nodeValue); |
353 | 353 | }); |
354 | 354 |
|
355 | | - // Set editor to blocked the original container |
| 355 | + // Set editor to block the original container |
356 | 356 | container.replaceWith(editor); |
357 | 357 | } |
358 | 358 |
|
|
558 | 558 | callbackContent; |
559 | 559 |
|
560 | 560 | if (this.$isPreview === true) { |
561 | | - // Avoid sequenced element creation on missused scenario |
| 561 | + // Avoid sequenced element creation on misused scenario |
562 | 562 | // @see https://github.com/toopay/bootstrap-markdown/issues/170 |
563 | 563 | return this; |
564 | 564 | } |
565 | 565 |
|
566 | | - // Give flag that tell the editor enter preview mode |
| 566 | + // Give flag that tells the editor to enter preview mode |
567 | 567 | this.$isPreview = true; |
568 | 568 | // Disable all buttons |
569 | 569 | this.disableButtons('all').enableButtons('cmdPreview'); |
570 | 570 |
|
571 | 571 | // Try to get the content from callback |
572 | 572 | callbackContent = options.onPreview(this, replacementContainer); |
573 | | - // Set the content based from the callback content if string otherwise parse value from textarea |
| 573 | + // Set the content based on the callback content if string, otherwise parse value from textarea |
574 | 574 | content = typeof callbackContent == 'string' ? callbackContent : this.parseContent(); |
575 | 575 |
|
576 | 576 | // Build preview element |
|
609 | 609 | return this; |
610 | 610 | }, |
611 | 611 | hidePreview: function() { |
612 | | - // Give flag that tell the editor quit preview mode |
| 612 | + // Give flag that tells the editor to quit preview mode |
613 | 613 | this.$isPreview = false; |
614 | 614 |
|
615 | 615 | // Obtain the preview container |
|
623 | 623 | // Disable configured disabled buttons |
624 | 624 | this.disableButtons(this.$options.disabledButtons); |
625 | 625 |
|
626 | | - // Perform any callback |
| 626 | + // Perform any callbacks |
627 | 627 | this.$options.onPreviewEnd(this); |
628 | 628 |
|
629 | 629 | // Back to the editor |
|
843 | 843 |
|
844 | 844 | blocked = true; |
845 | 845 | } else { |
846 | | - // The next tab memory contains nothing... |
| 846 | + // The next tab's memory contains nothing... |
847 | 847 | // check the cursor position to determine tab action |
848 | 848 | var cursor = this.getSelection(); |
849 | 849 |
|
850 | 850 | if (cursor.start == cursor.end && cursor.end == this.getContent().length) { |
851 | | - // The cursor already reach the end of the content |
| 851 | + // The cursor has reached the end of the content |
852 | 852 | blocked = false; |
853 | 853 | } else { |
854 | 854 | // Put the cursor to the end |
|
864 | 864 | blocked = false; |
865 | 865 | var chars = this.getContent().split(''); |
866 | 866 | var enterIndex = this.getSelection().start; |
867 | | - var priorNewlineIndex = -1; // initial line break at before 0 index |
| 867 | + var priorNewlineIndex = -1; // initial line break at before index 0 |
868 | 868 |
|
869 | | - // traverse backwards through chars to find last prior line break to check if was num/bullet item |
| 869 | + // traverse backwards through chars to check if last line break was num/bullet item |
870 | 870 | for (var i = enterIndex - 2; i >= 0; i--) { |
871 | 871 | if (chars[i] === '\n') { |
872 | 872 | priorNewlineIndex = i; |
|
1450 | 1450 | content; |
1451 | 1451 |
|
1452 | 1452 | if (isPreview === false) { |
1453 | | - // Give flag that tell the editor enter preview mode |
| 1453 | + // Give flag that tells the editor to enter preview mode |
1454 | 1454 | e.showPreview(); |
1455 | 1455 | } else { |
1456 | 1456 | e.hidePreview(); |
|
0 commit comments