"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _escapeHtml = _interopRequireDefault(require("escape-html"));

var _formatMessage = _interopRequireDefault(require("../../../format-message"));

var _clickCallback = _interopRequireDefault(require("./clickCallback"));

/*
 * Copyright (C) 2018 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */
tinymce.create("tinymce.plugins.InstructureEquation", {
  init: function init(ed) {
    ed.addCommand("instructureEquation", _clickCallback.default.bind(this, ed, document));
    ed.addButton("instructure_equation", {
      title: (0, _escapeHtml.default)("Wpisz r\xF3wnanie matematyczne"),
      cmd: "instructureEquation",
      icon: "equation icon-equation",
      onPostRender: function onPostRender() {
        var btn = this;
        ed.on("NodeChange", function (e) {
          btn.active(e.nodeName == "IMG" && e.className == "equation_image");
        });
      }
    });
  }
}); // Register plugin

tinymce.PluginManager.add("instructure_equation", tinymce.plugins.InstructureEquation);