Created
November 29, 2018 02:28
-
-
Save transcendr/287246e0c5d9d8739aad2a1ca9f56b63 to your computer and use it in GitHub Desktop.
plugin refactor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { organizeParagraphs } from './utils' | |
declare var define: any | |
export default ($editor: any) => { | |
;(function(factory: any) { | |
/* global define */ | |
if (typeof define === 'function' && define.amd) { | |
// AMD. Register as an anonymous module. | |
define(['jquery'], factory) | |
} else if (typeof module === 'object' && module.exports) { | |
// Node/CommonJS | |
module.exports = factory(require('jquery')) | |
} else { | |
// Browser globals | |
factory(window.$, $editor) | |
} | |
})(function($: any, editorId: any) { | |
window.$.extend(window.$.summernote.plugins, { | |
/** | |
* Handles the insertion of a new paragraph via | |
* the enter key. | |
*/ | |
observeChanges: function() { | |
// const $editor = $(editorId) | |
this.events = { | |
'summernote.change': function( | |
we: any, | |
contents: any, | |
$editable: any | |
) { | |
organizeParagraphs($) | |
} | |
} | |
} | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment