File tree 2 files changed +12
-15
lines changed
2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change 3
3
:id =" id"
4
4
:name =" name"
5
5
:data-ref =" reference"
6
- :data-config =" config"
7
- :data-toolbar =" toolbar"
6
+ :data-loaded =" loaded"
8
7
class =" field-textarea"
9
8
v-model =" v"
10
- v-richeditor
9
+ v-richeditor = " richeditorConfig "
11
10
@change =" change($event.target.value)"
12
11
v-if =" loaded"
13
12
/>
@@ -39,21 +38,17 @@ export default {
39
38
},
40
39
data () {
41
40
return {
42
- config : null ,
41
+ richeditorConfig : {} ,
43
42
loaded: false ,
44
- toolbar: null ,
45
43
v: null ,
46
44
};
47
45
},
48
46
mounted () {
49
47
this .$nextTick (() => {
50
- const map = BEDITA ? .richeditorByPropertyConfig ? .[this .field ] || null ;
51
- if (map) {
52
- map .config = map .config || {};
53
- map .toolbar = map .toolbar || {};
48
+ this .richeditorConfig = {
49
+ config: BEDITA ? .richeditorByPropertyConfig ? .[this .field ]? .config || {},
50
+ toolbar: BEDITA ? .richeditorByPropertyConfig ? .[this .field ]? .toolbar || null
54
51
}
55
- this .config = JSON .stringify (map? .config ) || null ;
56
- this .toolbar = JSON .stringify (map? .toolbar ) || null ;
57
52
this .v = this .value ;
58
53
this .loaded = true ;
59
54
this .$forceUpdate ();
Original file line number Diff line number Diff line change @@ -79,16 +79,18 @@ export default {
79
79
async inserted ( element , binding ) {
80
80
let changing = false ;
81
81
let toolbar = DEFAULT_TOOLBAR ;
82
- if ( element . dataset ?. toolbar ?. length > 0 || binding ?. expression ) {
83
- let exp = element . dataset ?. toolbar ?. length > 0 ? JSON . parse ( element . dataset . toolbar ) : JSON . parse ( binding . expression ) ;
82
+ if ( binding ?. value ?. toolbar ) {
83
+ toolbar = binding . value . toolbar . join ( ' ' ) ;
84
+ } else if ( binding ?. expression ) {
85
+ let exp = JSON . parse ( binding . expression ) ;
84
86
toolbar = exp ? exp . join ( ' ' ) : toolbar ;
85
87
}
86
88
if ( ! binding . modifiers ?. placeholders ) {
87
89
toolbar = toolbar . replace ( / \b p l a c e h o l d e r s \b / , '' ) ;
88
90
}
89
91
const sizes = { } ;
90
- if ( element . dataset ?. config ?. length > 0 ) {
91
- const c = JSON . parse ( element . dataset . config ) ;
92
+ if ( binding ?. value ?. config ) {
93
+ const c = binding . value . config ;
92
94
if ( c ?. height ) {
93
95
sizes . height = c . height ;
94
96
}
You can’t perform that action at this time.
0 commit comments