Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 0c93b36

Browse files
committed
Merge pull request #215 from orthes/feature-textareas
Add support for textareas - closes #179
2 parents 07a6c22 + e8952e8 commit 0c93b36

File tree

5 files changed

+123
-97
lines changed

5 files changed

+123
-97
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
],
2323
"dependencies": {
2424
"jquery": ">=1.9.0",
25-
"medium-editor": "^4.12.0",
25+
"medium-editor": "^5.7.0",
2626
"handlebars": "~3.0.0",
27-
"blueimp-file-upload": "~9.9.0",
27+
"blueimp-file-upload": "~9.11.1",
2828
"jquery-sortable": "~0.9.12"
2929
},
3030
"devDependencies": {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"devDependencies": {
1616
"grunt": "~0.4.4",
1717
"grunt-autoprefixer": "^3.0.1",
18-
"grunt-banner": "^0.2.3",
18+
"grunt-banner": "^0.5.0",
1919
"grunt-blanket-qunit": "^0.2.0",
20-
"grunt-contrib-concat": "^0.4.0",
21-
"grunt-contrib-handlebars": "^0.9.1",
20+
"grunt-contrib-concat": "^0.5.1",
21+
"grunt-contrib-handlebars": "^0.10.2",
2222
"grunt-contrib-jshint": "~0.11.0",
2323
"grunt-contrib-uglify": "~0.9.1",
2424
"grunt-contrib-watch": "~0.6.1",

src/js/core.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,13 +597,21 @@
597597

598598
$.fn[pluginName] = function (options) {
599599
return this.each(function () {
600-
if (!$.data(this, 'plugin_' + pluginName)) {
600+
var that = this,
601+
textareaId;
602+
603+
if ($(that).is('textarea')) {
604+
textareaId = $(that).attr('medium-editor-textarea-id');
605+
that = $(that).siblings('[medium-editor-textarea-id="'+ textareaId +'"]').get(0);
606+
}
607+
608+
if (!$.data(that, 'plugin_' + pluginName)) {
601609
// Plugin initialization
602-
$.data(this, 'plugin_' + pluginName, new Core(this, options));
603-
$.data(this, 'plugin_' + pluginName).init();
604-
} else if (typeof options === 'string' && $.data(this, 'plugin_' + pluginName)[options]) {
610+
$.data(that, 'plugin_' + pluginName, new Core(that, options));
611+
$.data(that, 'plugin_' + pluginName).init();
612+
} else if (typeof options === 'string' && $.data(that, 'plugin_' + pluginName)[options]) {
605613
// Method call
606-
$.data(this, 'plugin_' + pluginName)[options]();
614+
$.data(that, 'plugin_' + pluginName)[options]();
607615
}
608616
});
609617
};

0 commit comments

Comments
 (0)