PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.4.1-beta7
Secure Custom Fields v6.4.1-beta7
6.9.5 6.9.4 6.9.3 6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / assets / src / js / _acf-field-wysiwyg.js
secure-custom-fields / assets / src / js Last commit date
pro 1 year ago _acf-compatibility.js 1 year ago _acf-condition-types.js 1 year ago _acf-condition.js 1 year ago _acf-conditions.js 1 year ago _acf-field-accordion.js 1 year ago _acf-field-button-group.js 1 year ago _acf-field-checkbox.js 1 year ago _acf-field-color-picker.js 1 year ago _acf-field-date-picker.js 1 year ago _acf-field-date-time-picker.js 1 year ago _acf-field-file.js 1 year ago _acf-field-google-map.js 1 year ago _acf-field-icon-picker.js 1 year ago _acf-field-image.js 1 year ago _acf-field-link.js 1 year ago _acf-field-oembed.js 1 year ago _acf-field-page-link.js 1 year ago _acf-field-post-object.js 1 year ago _acf-field-radio.js 1 year ago _acf-field-range.js 1 year ago _acf-field-relationship.js 1 year ago _acf-field-select.js 1 year ago _acf-field-tab.js 1 year ago _acf-field-taxonomy.js 1 year ago _acf-field-time-picker.js 1 year ago _acf-field-true-false.js 1 year ago _acf-field-url.js 1 year ago _acf-field-user.js 1 year ago _acf-field-wysiwyg.js 1 year ago _acf-field.js 1 year ago _acf-fields.js 1 year ago _acf-helpers.js 1 year ago _acf-hooks.js 1 year ago _acf-internal-post-type.js 1 year ago _acf-media.js 1 year ago _acf-modal.js 1 year ago _acf-model.js 1 year ago _acf-notice.js 1 year ago _acf-panel.js 1 year ago _acf-popup.js 1 year ago _acf-postbox.js 1 year ago _acf-screen.js 1 year ago _acf-select2.js 1 year ago _acf-tinymce.js 1 year ago _acf-tooltip.js 1 year ago _acf-unload.js 1 year ago _acf-validation.js 1 year ago _acf.js 1 year ago _browse-fields-modal.js 1 year ago _field-group-compatibility.js 1 year ago _field-group-conditions.js 1 year ago _field-group-field.js 1 year ago _field-group-fields.js 1 year ago _field-group-locations.js 1 year ago _field-group-settings.js 1 year ago _field-group.js 1 year ago acf-escaped-html-notice.js 1 year ago acf-field-group.js 1 year ago acf-input.js 1 year ago acf-internal-post-type.js 1 year ago acf.js 1 year ago
_acf-field-wysiwyg.js
100 lines
1 ( function ( $, undefined ) {
2 var Field = acf.Field.extend( {
3 type: 'wysiwyg',
4
5 wait: 'load',
6
7 events: {
8 'mousedown .acf-editor-wrap.delay': 'onMousedown',
9 unmountField: 'disableEditor',
10 remountField: 'enableEditor',
11 removeField: 'disableEditor',
12 },
13
14 $control: function () {
15 return this.$( '.acf-editor-wrap' );
16 },
17
18 $input: function () {
19 return this.$( 'textarea' );
20 },
21
22 getMode: function () {
23 return this.$control().hasClass( 'tmce-active' )
24 ? 'visual'
25 : 'text';
26 },
27
28 initialize: function () {
29 // initializeEditor if no delay
30 if ( ! this.$control().hasClass( 'delay' ) ) {
31 this.initializeEditor();
32 }
33 },
34
35 initializeEditor: function () {
36 // vars
37 var $wrap = this.$control();
38 var $textarea = this.$input();
39 var args = {
40 tinymce: true,
41 quicktags: true,
42 toolbar: this.get( 'toolbar' ),
43 mode: this.getMode(),
44 field: this,
45 };
46
47 // generate new id
48 var oldId = $textarea.attr( 'id' );
49 var newId = acf.uniqueId( 'acf-editor-' );
50
51 // Backup textarea data.
52 var inputData = $textarea.data();
53 var inputVal = $textarea.val();
54
55 // rename
56 acf.rename( {
57 target: $wrap,
58 search: oldId,
59 replace: newId,
60 destructive: true,
61 } );
62
63 // update id
64 this.set( 'id', newId, true );
65
66 // apply data to new textarea (acf.rename creates a new textarea element due to destructive mode)
67 // fixes bug where conditional logic "disabled" is lost during "screen_check"
68 this.$input().data( inputData ).val( inputVal );
69
70 // initialize
71 acf.tinymce.initialize( newId, args );
72 },
73
74 onMousedown: function ( e ) {
75 // prevent default
76 e.preventDefault();
77
78 // remove delay class
79 var $wrap = this.$control();
80 $wrap.removeClass( 'delay' );
81 $wrap.find( '.acf-editor-toolbar' ).remove();
82
83 // initialize
84 this.initializeEditor();
85 },
86
87 enableEditor: function () {
88 if ( this.getMode() == 'visual' ) {
89 acf.tinymce.enable( this.get( 'id' ) );
90 }
91 },
92
93 disableEditor: function () {
94 acf.tinymce.destroy( this.get( 'id' ) );
95 },
96 } );
97
98 acf.registerFieldType( Field );
99 } )( jQuery );
100