Skip to content

Commit 952651e

Browse files
author
Park Hyunwoo
committed
Apply width on editable
1 parent 7dde8b3 commit 952651e

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

src/js/base/module/Codeview.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ define([
5454
*/
5555
this.activate = function () {
5656
$codable.val(dom.html($editable, options.prettifyHtml));
57+
$codable.width($editable.width());
5758
$codable.height($editable.height());
5859

5960
context.invoke('toolbar.updateCodeview', true);
@@ -74,7 +75,7 @@ define([
7475
}
7576

7677
// CodeMirror hasn't Padding.
77-
cmEditor.setSize(null, $editable.outerHeight());
78+
cmEditor.setSize($editable.outerWidth(), $editable.outerHeight());
7879
$codable.data('cmEditor', cmEditor);
7980
}
8081
};
@@ -94,7 +95,6 @@ define([
9495
var isChange = $editable.html() !== value;
9596

9697
$editable.html(value);
97-
$editable.height(options.height ? $codable.height() : 'auto');
9898
$editor.removeClass('codeview');
9999

100100
if (isChange) {

src/js/base/module/Editor.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,19 @@ define([
8282
context.triggerEvent('focusout', event);
8383
});
8484

85-
if (!options.airMode && options.height) {
86-
this.setHeight(options.height);
87-
}
88-
if (!options.airMode && options.maxHeight) {
89-
$editable.css('max-height', options.maxHeight);
90-
}
91-
if (!options.airMode && options.minHeight) {
92-
$editable.css('min-height', options.minHeight);
85+
if (!options.airMode) {
86+
if (options.width) {
87+
$editable.outerWidth(options.width);
88+
}
89+
if (options.height) {
90+
$editable.outerHeight(options.height);
91+
}
92+
if (options.maxHeight) {
93+
$editable.css('max-height', options.maxHeight);
94+
}
95+
if (options.minHeight) {
96+
$editable.css('min-height', options.minHeight);
97+
}
9398
}
9499

95100
history.recordUndo();
@@ -733,13 +738,6 @@ define([
733738
this.empty = function () {
734739
context.invoke('code', dom.emptyPara);
735740
};
736-
737-
/**
738-
* set height for editable
739-
*/
740-
this.setHeight = function (height) {
741-
$editable.outerHeight(height);
742-
};
743741
};
744742

745743
return Editor;

0 commit comments

Comments
 (0)