# all files / src/js/base/module/ AutoSync.js

88.89% Statements 8/9
100% Branches 0/0
75% Functions 3/4
88.89% Lines 8/9

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    201×

    1×
    92×
    91×
    91×

    1×
    93×

    1×
     import dom from '../core/dom';

    /**
     * textarea auto sync.
     */
    export default class AutoSync {
      constructor(context) {
        this.$note = context.layoutInfo.note;
        this.events = {
          'summernote.change': () => {
            this.$note.val(context.invoke('code'));
          }
        };
      }

      shouldInitialize() {
        return dom.isTextarea(this.$note[0]);
      }
    }