Skip to content

Commit

Permalink
Allow developers to use summernote source as requirejs package
Browse files Browse the repository at this point in the history
  • Loading branch information
zbigniewmotyka committed Mar 5, 2014
1 parent 9423dc1 commit 37f08a6
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 31 deletions.
9 changes: 7 additions & 2 deletions build/grunt-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function (grunt) {
};

var config = {
name: 'summernote',
name: 'summernote/summernote',
baseUrl: this.data.baseUrl,
out: out,
optimize: 'none',
Expand All @@ -60,7 +60,12 @@ module.exports = function (grunt) {
paths: {
jquery: 'empty:',
CodeMirror: 'empty:'
}
},
packages: [{
name: 'summernote',
location: './',
main: 'summernote'
}]
};

var done = this.async();
Expand Down
3 changes: 2 additions & 1 deletion dist/summernote.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright 2013 Alan Hong. and outher contributors
* summernote may be freely distributed under the MIT license./
*
* Date: 2014-03-05T04:19Z
* Date: 2014-03-05T12:17Z
*/
(function (factory) {
/* global define */
Expand Down Expand Up @@ -2295,6 +2295,7 @@
} else if (sEvent === 'showLinkDialog') { // popover to dialog
$editable.focus();
var linkInfo = editor.getLinkInfo();

editor.saveRange($editable);
dialog.showLinkDialog($editable, $dialog, linkInfo).then(function (sLinkUrl, bNewWindow) {
editor.restoreRange($editable);
Expand Down
6 changes: 3 additions & 3 deletions src/js/EventHandler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
define([
'CodeMirror',
'core/agent', 'core/dom', 'core/async', 'core/key',
'editing/Style', 'editing/Editor', 'editing/History',
'module/Toolbar', 'module/Popover', 'module/Handle', 'module/Dialog'
'summernote/core/agent', 'summernote/core/dom', 'summernote/core/async', 'summernote/core/key',
'summernote/editing/Style', 'summernote/editing/Editor', 'summernote/editing/History',
'summernote/module/Toolbar', 'summernote/module/Popover', 'summernote/module/Handle', 'summernote/module/Dialog'
], function (CodeMirror,
agent, dom, async, key,
Style, Editor, History,
Expand Down
2 changes: 1 addition & 1 deletion src/js/Renderer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
'core/agent', 'core/dom'
'summernote/core/agent', 'summernote/core/dom'
], function (agent, dom) {
/**
* renderer
Expand Down
7 changes: 6 additions & 1 deletion src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ require.config({
CodeMirror: { exports: 'CodeMirror' },
CodeMirrorXml: ['CodeMirror'],
CodeMirrorFormatting: ['CodeMirror', 'CodeMirrorXml']
}
},
packages: [{
name: 'summernote',
location: './',
main: 'summernote'
}]
});

require([
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/async.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('core/async', function () {
define('summernote/core/async', function () {
/**
* Async functions which returns `Promise`
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/dom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['core/func', 'core/list', 'core/agent'], function (func, list, agent) {
define(['summernote/core/func', 'summernote/core/list', 'summernote/core/agent'], function (func, list, agent) {
/**
* Dom functions
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/func.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('core/func', function () {
define('summernote/core/func', function () {
/**
* func utils (for high-order func's arg)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/key.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('core/key', function () {
define('summernote/core/key', function () {
/**
* Object for keycodes.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['core/func'], function (func) {
define(['summernote/core/func'], function (func) {
/**
* list utils
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/range.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
'core/func', 'core/list', 'core/dom'
'summernote/core/func', 'summernote/core/list', 'summernote/core/dom'
], function (func, list, dom) {
/**
* range module
Expand Down
3 changes: 2 additions & 1 deletion src/js/editing/Editor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
define([
'core/agent', 'core/dom', 'core/range', 'core/async', 'editing/Style', 'editing/Table'
'summernote/core/agent', 'summernote/core/dom', 'summernote/core/range',
'summernote/core/async', 'summernote/editing/Style', 'summernote/editing/Table'
], function (agent, dom, range, async, Style, Table) {
/**
* Editor
Expand Down
2 changes: 1 addition & 1 deletion src/js/editing/History.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['core/range'], function (range) {
define(['summernote/core/range'], function (range) {
/**
* History
* @class
Expand Down
4 changes: 2 additions & 2 deletions src/js/editing/Style.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define([
'core/agent',
'core/dom'
'summernote/core/agent',
'summernote/core/dom'
], function (agent, dom) {
/**
* Style
Expand Down
2 changes: 1 addition & 1 deletion src/js/editing/Table.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
'core/dom', 'core/range', 'core/list'
'summernote/core/dom', 'summernote/core/range', 'summernote/core/list'
], function (dom, range, list) {
/**
* Table
Expand Down
2 changes: 1 addition & 1 deletion src/js/module/Dialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('module/Dialog', function () {
define('summernote/module/Dialog', function () {
/**
* Dialog
*
Expand Down
2 changes: 1 addition & 1 deletion src/js/module/Handle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('module/Handle', function () {
define('summernote/module/Handle', function () {
/**
* Handle
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/module/Popover.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('module/Popover', function () {
define('summernote/module/Popover', function () {
/**
* Popover (http://getbootstrap.com/javascript/#popovers)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/module/Toolbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
'core/list'
'summernote/core/list'
], function (list) {
/**
* Toolbar
Expand Down
2 changes: 1 addition & 1 deletion src/js/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define('settings', function () {
define('summernote/settings', function () {
var settings = {
// version
version: '@VERSION',
Expand Down
6 changes: 3 additions & 3 deletions src/js/summernote.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define([
'core/agent', 'core/dom',
'settings',
'EventHandler', 'Renderer'
'summernote/core/agent', 'summernote/core/dom',
'summernote/settings',
'summernote/EventHandler', 'summernote/Renderer'
], function (agent, dom, settings, EventHandler, Renderer) {
// jQuery namespace for summernote
$.summernote = $.summernote || {};
Expand Down
7 changes: 6 additions & 1 deletion test/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ require.config({
},
shim: {
CodeMirror: { exports: 'CodeMirror' },
}
},
packages: [{
name: 'summernote',
location: './',
main: 'summernote'
}]
});

require([
Expand Down
2 changes: 1 addition & 1 deletion test/unit/dom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* (c) 2013~ Alan Hong
* summernote may be freely distributed under the MIT license./
*/
define(['jquery', 'core/dom', 'core/func'], function ($, dom, func) {
define(['jquery', 'summernote/core/dom', 'summernote/core/func'], function ($, dom, func) {
return function () {
test('dom.ancestor', function () {
var $cont, $b, elB;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* (c) 2013~ Alan Hong
* summernote may be freely distributed under the MIT license./
*/
define(['jquery', 'core/list'], function ($, list) {
define(['jquery', 'summernote/core/list'], function ($, list) {
return function () {
test('list.head', function () {
deepEqual(list.head([1, 2, 3]), 1, 'should return the first element');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/range.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* (c) 2013~ Alan Hong
* summernote may be freely distributed under the MIT license./
*/
define(['jquery', 'core/dom', 'core/range'], function ($, dom, range) {
define(['jquery', 'summernote/core/dom', 'summernote/core/range'], function ($, dom, range) {
return function () {
test('rng.nodes', function () {
var rng, $cont, $para, $li, $h1, $h2, $b;
Expand Down

0 comments on commit 37f08a6

Please sign in to comment.