mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
修复弹出框里面的 rich-text 默认宽度不正确的问题
This commit is contained in:
parent
9332656924
commit
62d6f8e3a7
@ -9,6 +9,10 @@
|
||||
border: 0;
|
||||
}
|
||||
|
||||
> textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
min-height: px2rem(200px);
|
||||
height: auto;
|
||||
border: $Form-input-borderWidth solid $Form-input-borderColor;
|
||||
|
@ -49,6 +49,7 @@ import $ from 'jquery';
|
||||
// Require Editor CSS files.
|
||||
import 'froala-editor/css/froala_style.min.css';
|
||||
import 'froala-editor/css/froala_editor.pkgd.min.css';
|
||||
import {resizeSensor} from '../utils/resize-sensor';
|
||||
|
||||
export default class FroalaEditor extends React.Component<any, any> {
|
||||
listeningEvents: Array<any> = [];
|
||||
@ -87,6 +88,16 @@ export default class FroalaEditor extends React.Component<any, any> {
|
||||
this.$element = $(ref);
|
||||
this.setContent(true);
|
||||
this.registerEvents();
|
||||
resizeSensor(
|
||||
ref.parentElement,
|
||||
() => {
|
||||
$(ref)
|
||||
.prev('.fr-box')
|
||||
.find('.fr-toolbar')
|
||||
.css('width', '');
|
||||
},
|
||||
true
|
||||
);
|
||||
this.$editor = this.$element
|
||||
.froalaEditor(this.config)
|
||||
.data('froala.editor').$el;
|
||||
|
@ -122,7 +122,19 @@ function detach(element: HTMLElement) {
|
||||
}
|
||||
}
|
||||
|
||||
export function resizeSensor(element: HTMLElement, callback: Function) {
|
||||
export function resizeSensor(
|
||||
element: HTMLElement,
|
||||
callback: Function,
|
||||
once: boolean = false
|
||||
) {
|
||||
if (once) {
|
||||
attachResizeEvent(element, function(this: any) {
|
||||
callback.apply(this, arguments);
|
||||
detach(element);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
attachResizeEvent(element, callback);
|
||||
let detached = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user