diff --git a/dist/grapes.js b/dist/grapes.js index f2a167c9b8..068f00d13a 100644 --- a/dist/grapes.js +++ b/dist/grapes.js @@ -7,7 +7,7 @@ exports["grapesjs"] = factory(); else root["grapesjs"] = factory(); -})(this, function() { +})(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -93,11 +93,11 @@ return /******/ (function(modules) { // webpackBootstrap // Set up Backbone appropriately for the environment. Start with AMD. if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(9), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(9), exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function(_, $, exports) { // Export global even in AMD case in case this script is loaded with // others that may still expect a global Backbone. root.Backbone = factory(root, exports, _, $); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // Next for Node.js or CommonJS. jQuery may not be needed as a module. @@ -1999,7 +1999,7 @@ return /******/ (function(modules) { // webpackBootstrap return Backbone; }); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10))) /***/ }), /* 1 */ @@ -3548,9 +3548,9 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Underscor // an AMD load request. Those cases could generate an error when an // anonymous define() is called outside of a loader request. if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { return _; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } }.call(this)); @@ -4073,7 +4073,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var Backbone = __webpack_require__(0); var Components = __webpack_require__(50); var Selector = __webpack_require__(7); -var Selectors = __webpack_require__(10); +var Selectors = __webpack_require__(11); var Traits = __webpack_require__(151); var componentList = {}; var componentIndex = 0; @@ -8693,8 +8693,10 @@ function updateHeightsInViewport(cm) { // Read and store the height of line widgets associated with the // given line. function updateWidgetHeight(line) { - if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) - { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } } + if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) { + var w = line.widgets[i], parent = w.node.parentNode; + if (parent) { w.height = parent.offsetHeight; } + } } } // Compute the lines that are visible in a given viewport (defaults @@ -12000,11 +12002,11 @@ function onResize(cm) { } var keyNames = { - 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", + 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", - 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", + 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", 145: "ScrollLock", 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete", 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert" @@ -12151,6 +12153,9 @@ function keyName(event, noShift) { if (presto && event.keyCode == 34 && event["char"]) { return false } var name = keyNames[event.keyCode]; if (name == null || event.altGraphKey) { return false } + // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause, + // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+) + if (event.keyCode == 3 && event.code) { name = event.code; } return addModifierNames(name, event, noShift) } @@ -12490,18 +12495,26 @@ function lookupKeyForEditor(cm, name, handle) { // for bound mouse clicks. var stopSeq = new Delayed; + function dispatchKey(cm, name, e, handle) { var seq = cm.state.keySeq; if (seq) { if (isModifierKey(name)) { return "handled" } - stopSeq.set(50, function () { - if (cm.state.keySeq == seq) { - cm.state.keySeq = null; - cm.display.input.reset(); - } - }); - name = seq + " " + name; + if (/\'$/.test(name)) + { cm.state.keySeq = null; } + else + { stopSeq.set(50, function () { + if (cm.state.keySeq == seq) { + cm.state.keySeq = null; + cm.display.input.reset(); + } + }); } + if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true } } + return dispatchKeyInner(cm, name, e, handle) +} + +function dispatchKeyInner(cm, name, e, handle) { var result = lookupKeyForEditor(cm, name, handle); if (result == "multi") @@ -12514,10 +12527,6 @@ function dispatchKey(cm, name, e, handle) { restartBlink(cm); } - if (seq && !result && /\'$/.test(name)) { - e_preventDefault(e); - return true - } return !!result } @@ -13029,6 +13038,7 @@ function defineOptions(CodeMirror) { clearCaches(cm); regChange(cm); }, true); + option("lineSeparator", null, function (cm, val) { cm.doc.lineSep = val; if (!val) { return } @@ -13435,7 +13445,7 @@ function applyTextInput(cm, inserted, deleted, sel, origin) { var paste = cm.state.pasteIncoming || origin == "paste"; var textLines = splitLinesAuto(inserted), multiPaste = null; - // When pasing N lines into N selections, insert one line per selection + // When pasting N lines into N selections, insert one line per selection if (paste && sel.ranges.length > 1) { if (lastCopied && lastCopied.text.join("\n") == inserted) { if (sel.ranges.length % lastCopied.text.length == 0) { @@ -15069,7 +15079,7 @@ CodeMirror$1.fromTextArea = fromTextArea; addLegacyProps(CodeMirror$1); -CodeMirror$1.version = "5.31.0"; +CodeMirror$1.version = "5.34.0"; return CodeMirror$1; @@ -15335,7 +15345,7 @@ module.exports = Backbone.View.extend({ "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; -/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */ +/*! cash-dom 1.3.7, https://github.com/kenwheeler/cash @license MIT */ ;(function (root, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), @@ -15369,7 +15379,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; var frag; function parseHTML(str) { if (!frag) { - frag = doc.implementation.createHTMLDocument(); + frag = doc.implementation.createHTMLDocument(null); var base = frag.createElement("base"); base.href = doc.location.href; frag.head.appendChild(base); @@ -15382,7 +15392,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; function onReady(fn) { if (doc.readyState !== "loading") { - fn(); + setTimeout(fn); } else { doc.addEventListener("DOMContentLoaded", fn); } @@ -15596,10 +15606,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; return (v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className)); } - function addClass(v, c, spacedName) { + function addClass(v, c) { if (v.classList) { v.classList.add(c); - } else if (spacedName.indexOf(" " + c + " ")) { + } else if (!hasClass(v, c)) { v.className += " " + c; } } @@ -15617,9 +15627,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; var classes = getClasses(c); return (classes ? this.each(function (v) { - var spacedName = " " + v.className + " "; each(classes, function (c) { - addClass(v, c, spacedName); + addClass(v, c); }); }) : this); }, @@ -15709,12 +15718,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; } var classes = getClasses(c); return (classes ? this.each(function (v) { - var spacedName = " " + v.className + " "; each(classes, function (c) { if (hasClass(v, c)) { removeClass(v, c); } else { - addClass(v, c, spacedName); + addClass(v, c); } }); }) : this); @@ -16300,6 +16308,33 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; /***/ }), /* 10 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -16333,7 +16368,7 @@ module.exports = __webpack_require__(0).Collection.extend({ }); /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -16347,7 +16382,7 @@ var _TypeableCollection2 = _interopRequireDefault(_TypeableCollection); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var Property = __webpack_require__(12); +var Property = __webpack_require__(13); module.exports = __webpack_require__(0).Collection.extend(_TypeableCollection2.default).extend({ types: [{ @@ -16416,7 +16451,7 @@ module.exports = __webpack_require__(0).Collection.extend(_TypeableCollection2.d }, { id: 'integer', model: __webpack_require__(42), - view: __webpack_require__(14), + view: __webpack_require__(15), isType: function isType(value) { if (value && value.type == 'integer') { return value; @@ -16470,7 +16505,7 @@ module.exports = __webpack_require__(0).Collection.extend(_TypeableCollection2.d }); /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -16629,14 +16664,14 @@ module.exports = __webpack_require__(0).Model.extend({ }); /***/ }), -/* 13 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(Backbone) { var PropertyView = __webpack_require__(5); -var PropertyIntegerView = __webpack_require__(14); +var PropertyIntegerView = __webpack_require__(15); var PropertyRadioView = __webpack_require__(36); var PropertySelectView = __webpack_require__(37); var PropertyColorView = __webpack_require__(38); @@ -16703,7 +16738,7 @@ module.exports = Backbone.View.extend({ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -16748,7 +16783,7 @@ module.exports = PropertyView.extend({ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 15 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -16843,33 +16878,6 @@ module.exports = ComponentView.extend({ } }); -/***/ }), -/* 16 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { @@ -16934,7 +16942,7 @@ module.exports = PropertyView.extend({ prop.parent = model; }, this); - var PropertiesView = __webpack_require__(13); + var PropertiesView = __webpack_require__(14); var propsView = new PropertiesView(this.getPropsConfig()); this.$props = propsView.render().$el; this.properties = propsView.properties; @@ -19010,9 +19018,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return ret("qualifier", "qualifier"); } else if (/[:;{}\[\]\(\)]/.test(ch)) { return ret(null, ch); - } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) || - (ch == "d" && stream.match("omain(")) || - (ch == "r" && stream.match("egexp("))) { + } else if (((ch == "u" || ch == "U") && stream.match(/rl(-prefix)?\(/i)) || + ((ch == "d" || ch == "D") && stream.match("omain(", true, true)) || + ((ch == "r" || ch == "R") && stream.match("egexp(", true, true))) { stream.backUp(1); state.tokenize = tokenParenthesized; return ret("property", "word"); @@ -19095,16 +19103,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return pushContext(state, stream, "block"); } else if (type == "}" && state.context.prev) { return popContext(state); - } else if (supportsAtComponent && /@component/.test(type)) { + } else if (supportsAtComponent && /@component/i.test(type)) { return pushContext(state, stream, "atComponentBlock"); - } else if (/^@(-moz-)?document$/.test(type)) { + } else if (/^@(-moz-)?document$/i.test(type)) { return pushContext(state, stream, "documentTypes"); - } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) { + } else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) { return pushContext(state, stream, "atBlock"); - } else if (/^@(font-face|counter-style)/.test(type)) { + } else if (/^@(font-face|counter-style)/i.test(type)) { state.stateArg = type; return "restricted_atBlock_before"; - } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { + } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) { return "keyframes"; } else if (type && type.charAt(0) == "@") { return pushContext(state, stream, "at"); @@ -19726,7 +19734,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { }, "@": function(stream) { if (stream.eat("{")) return [null, "interpolation"]; - if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false; + if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false; stream.eatWhile(/[\w\\\-]/); if (stream.match(/^\s*:/, false)) return ["variable-2", "variable-definition"]; @@ -20131,7 +20139,7 @@ module.exports = function () { var c = {}, defaults = __webpack_require__(117), Sectors = __webpack_require__(118), - Properties = __webpack_require__(11), + Properties = __webpack_require__(12), SectorsView = __webpack_require__(129); var properties = void 0; var sectors, SectView; @@ -20644,7 +20652,7 @@ exports.default = { var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; -var Property = __webpack_require__(12); +var Property = __webpack_require__(13); module.exports = Property.extend({ defaults: _extends({}, Property.prototype.defaults, { @@ -20668,7 +20676,7 @@ module.exports = Property.extend({ init: function init() { var properties = this.get('properties') || []; - var Properties = __webpack_require__(11); + var Properties = __webpack_require__(12); this.set('properties', new Properties(properties)); this.listenTo(this, 'change:value', this.updateValues); }, @@ -20884,7 +20892,7 @@ module.exports = PropertyCompositeView.extend({ var self = this; var model = this.model; var fieldEl = this.el.querySelector('[data-layers-wrapper]'); - var PropertiesView = __webpack_require__(13); + var PropertiesView = __webpack_require__(14); var propsConfig = { target: this.target, propTarget: this.propTarget, @@ -21132,7 +21140,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument var InputColor = __webpack_require__(39); -module.exports = __webpack_require__(14).extend({ +module.exports = __webpack_require__(15).extend({ setValue: function setValue(value) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -21425,7 +21433,7 @@ module.exports = PropertyView.extend({ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; -var Property = __webpack_require__(12); +var Property = __webpack_require__(13); module.exports = Property.extend({ defaults: _extends({}, Property.prototype.defaults, { @@ -21445,7 +21453,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument var _underscore = __webpack_require__(1); -var Property = __webpack_require__(12); +var Property = __webpack_require__(13); var InputNumber = __webpack_require__(18); module.exports = Property.extend({ @@ -22056,7 +22064,7 @@ var _Styleable2 = _interopRequireDefault(_Styleable); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Backbone = __webpack_require__(0); -var Selectors = __webpack_require__(10); +var Selectors = __webpack_require__(11); module.exports = Backbone.Model.extend(_Styleable2.default).extend({ defaults: { @@ -23681,7 +23689,7 @@ module.exports = function () { plugins: plugins, // Will be replaced on build - version: '0.13.10', + version: '0.14.5', /** * Initializes an editor based on passed options @@ -28422,11 +28430,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // Set up Backbone appropriately for the environment. Start with AMD. if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(9), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(9), exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function(_, $, exports) { // Export global even in AMD case in case this script is loaded with // others that may still expect a global Backbone. root.Backbone = factory(root, exports, _, $); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // Next for Node.js or CommonJS. jQuery may not be needed as a module. @@ -30281,7 +30289,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ })); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10))) /***/ }), /* 72 */ @@ -30855,7 +30863,7 @@ module.exports = __webpack_require__(0).Model.extend({ } function Promise(fn) { - if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new'); + if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new'); if (typeof fn !== 'function') throw new TypeError('not a function'); this._state = 0; this._handled = false; @@ -30979,9 +30987,9 @@ module.exports = __webpack_require__(0).Model.extend({ }; Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); - return new Promise(function (resolve, reject) { + if (!arr || typeof arr.length === 'undefined') throw new TypeError('Promise.all accepts an array'); + var args = Array.prototype.slice.call(arr); if (args.length === 0) return resolve([]); var remaining = args.length; @@ -31079,7 +31087,7 @@ module.exports = __webpack_require__(0).Model.extend({ /* 77 */ /***/ (function(module, exports, __webpack_require__) { -var apply = Function.prototype.apply; +/* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply; // DOM APIs, for completeness @@ -31130,9 +31138,17 @@ exports._unrefActive = exports.active = function(item) { // setimmediate attaches itself to the global object __webpack_require__(78); -exports.setImmediate = setImmediate; -exports.clearImmediate = clearImmediate; - +// On some exotic environments, it's not clear which object `setimmeidate` was +// able to install onto. Search each possibility in the same order as the +// `setimmediate` library. +exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) || + (typeof global !== "undefined" && global.setImmediate) || + (this && this.setImmediate); +exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || + (typeof global !== "undefined" && global.clearImmediate) || + (this && this.clearImmediate); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10))) /***/ }), /* 78 */ @@ -31325,7 +31341,7 @@ exports.clearImmediate = clearImmediate; attachTo.clearImmediate = clearImmediate; }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self)); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16), __webpack_require__(79))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(79))) /***/ }), /* 79 */ @@ -32133,7 +32149,7 @@ module.exports = function (config) { var c = config || {}, defaults = __webpack_require__(89), Selector = __webpack_require__(7), - Selectors = __webpack_require__(10), + Selectors = __webpack_require__(11), ClassTagsView = __webpack_require__(90); var selectors, selectorTags; @@ -33906,6 +33922,7 @@ var xmlConfig = { doNotIndent: {}, allowUnquoted: false, allowMissing: false, + allowMissingTagName: false, caseFold: false } @@ -34080,6 +34097,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { state.tagName = stream.current(); setStyle = "tag"; return attrState; + } else if (config.allowMissingTagName && type == "endTag") { + setStyle = "tag bracket"; + return attrState(type, stream, state); } else { setStyle = "error"; return tagNameState; @@ -34098,6 +34118,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { setStyle = "tag error"; return closeStateErr; } + } else if (config.allowMissingTagName && type == "endTag") { + setStyle = "tag bracket"; + return closeState(type, stream, state); } else { setStyle = "error"; return closeStateErr; @@ -34280,7 +34303,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d"); var operator = kw("operator"), atom = {type: "atom", style: "atom"}; - var jsKeywords = { + return { "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, "return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C, "debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"), @@ -34292,35 +34315,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { "yield": C, "export": kw("export"), "import": kw("import"), "extends": C, "await": C }; - - // Extend the 'normal' keywords with the TypeScript language extensions - if (isTS) { - var type = {type: "variable", style: "type"}; - var tsKeywords = { - // object-like things - "interface": kw("class"), - "implements": C, - "namespace": C, - "module": kw("module"), - "enum": kw("module"), - - // scope modifiers - "public": kw("modifier"), - "private": kw("modifier"), - "protected": kw("modifier"), - "abstract": kw("modifier"), - "readonly": kw("modifier"), - - // types - "string": type, "number": type, "boolean": type, "any": type - }; - - for (var attr in tsKeywords) { - jsKeywords[attr] = tsKeywords[attr]; - } - } - - return jsKeywords; }(); var isOperatorChar = /[+\-*&%=<>!?|~^@]/; @@ -34409,7 +34403,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var kw = keywords[word] return ret(kw.type, kw.style, word) } - if (word == "async" && stream.match(/^\s*[\(\w]/, false)) + if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\(\w]/, false)) return ret("async", "keyword", word) } return ret("variable", "variable", word) @@ -34566,6 +34560,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } } + function isModifier(name) { + return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly" + } + // Combinators var defaultVars = {name: "this", next: {name: "arguments"}}; @@ -34622,13 +34620,19 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } if (type == "function") return cont(functiondef); if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); + if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), className, poplex); } if (type == "variable") { - if (isTS && value == "type") { - cx.marked = "keyword" - return cont(typeexpr, expect("operator"), typeexpr, expect(";")); - } if (isTS && value == "declare") { + if (isTS && value == "declare") { cx.marked = "keyword" return cont(statement) + } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) { + cx.marked = "keyword" + if (value == "enum") return cont(enumdef); + else if (value == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";")); + else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex) + } else if (isTS && value == "namespace") { + cx.marked = "keyword" + return cont(pushlex("form"), expression, block, poplex) } else { return cont(pushlex("stat"), maybelabel); } @@ -34639,25 +34643,23 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "default") return cont(expect(":")); if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), statement, poplex, popcontext); - if (type == "class") return cont(pushlex("form"), className, poplex); if (type == "export") return cont(pushlex("stat"), afterExport, poplex); if (type == "import") return cont(pushlex("stat"), afterImport, poplex); - if (type == "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex) if (type == "async") return cont(statement) if (value == "@") return cont(expression, statement) return pass(pushlex("stat"), expression, expect(";"), poplex); } - function expression(type) { - return expressionInner(type, false); + function expression(type, value) { + return expressionInner(type, value, false); } - function expressionNoComma(type) { - return expressionInner(type, true); + function expressionNoComma(type, value) { + return expressionInner(type, value, true); } function parenExpr(type) { if (type != "(") return pass() return cont(pushlex(")"), expression, expect(")"), poplex) } - function expressionInner(type, noComma) { + function expressionInner(type, value, noComma) { if (cx.state.fatArrowAt == cx.stream.start) { var body = noComma ? arrowBodyNoComma : arrowBody; if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext); @@ -34667,7 +34669,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); if (type == "function") return cont(functiondef, maybeop); - if (type == "class") return cont(pushlex("form"), classExpression, poplex); + if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); } if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression); if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); @@ -34692,6 +34694,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); if (type == "operator") { if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me); + if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false)) + return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me); if (value == "?") return cont(expression, expect(":"), expr); return cont(expr); } @@ -34763,10 +34767,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont(afterprop); } else if (type == "jsonld-keyword") { return cont(afterprop); - } else if (type == "modifier") { + } else if (isTS && isModifier(value)) { + cx.marked = "keyword" return cont(objprop) } else if (type == "[") { - return cont(expression, expect("]"), afterprop); + return cont(expression, maybetype, expect("]"), afterprop); } else if (type == "spread") { return cont(expressionNoComma, afterprop); } else if (value == "*") { @@ -34818,6 +34823,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (value == "?") return cont(maybetype); } } + function mayberettype(type) { + if (isTS && type == ":") { + if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr) + else return cont(typeexpr) + } + } + function isKW(_, value) { + if (value == "is") { + cx.marked = "keyword" + return cont() + } + } function typeexpr(type, value) { if (type == "variable" || value == "void") { if (value == "keyof") { @@ -34856,16 +34873,23 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) if (value == "|" || type == ".") return cont(typeexpr) if (type == "[") return cont(expect("]"), afterType) - if (value == "extends") return cont(typeexpr) + if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) } } function maybeTypeArgs(_, value) { if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) } - function vardef() { + function typeparam() { + return pass(typeexpr, maybeTypeDefault) + } + function maybeTypeDefault(_, value) { + if (value == "=") return cont(typeexpr) + } + function vardef(_, value) { + if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)} return pass(pattern, maybetype, maybeAssign, vardefCont); } function pattern(type, value) { - if (type == "modifier") return cont(pattern) + if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) } if (type == "variable") { register(value); return cont(); } if (type == "spread") return cont(pattern); if (type == "[") return contCommasep(pattern, "]"); @@ -34914,12 +34938,13 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function functiondef(type, value) { if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} if (type == "variable") {register(value); return cont(functiondef);} - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext); - if (isTS && value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef) + if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext); + if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef) } function funarg(type, value) { if (value == "@") cont(expression, funarg) - if (type == "spread" || type == "modifier") return cont(funarg); + if (type == "spread") return cont(funarg); + if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); } return pass(pattern, maybetype, maybeAssign); } function classExpression(type, value) { @@ -34931,15 +34956,17 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "variable") {register(value); return cont(classNameAfter);} } function classNameAfter(type, value) { - if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter) - if (value == "extends" || value == "implements" || (isTS && type == ",")) + if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter) + if (value == "extends" || value == "implements" || (isTS && type == ",")) { + if (value == "implements") cx.marked = "keyword"; return cont(isTS ? typeexpr : expression, classNameAfter); + } if (type == "{") return cont(pushlex("}"), classBody, poplex); } function classBody(type, value) { - if (type == "modifier" || type == "async" || + if (type == "async" || (type == "variable" && - (value == "static" || value == "get" || value == "set") && + (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) && cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) { cx.marked = "keyword"; return cont(classBody); @@ -34949,7 +34976,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont(isTS ? classfield : functiondef, classBody); } if (type == "[") - return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody) + return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody) if (value == "*") { cx.marked = "keyword"; return cont(classBody); @@ -34997,6 +35024,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "]") return cont(); return pass(commasep(expressionNoComma, "]")); } + function enumdef() { + return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex) + } + function enummember() { + return pass(pattern, maybeAssign); + } function isContinuedStatement(state, textAfter) { return state.lastType == "operator" || state.lastType == "," || @@ -36809,7 +36842,7 @@ module.exports = __webpack_require__(0).Collection.extend({ var _underscore = __webpack_require__(1); var Backbone = __webpack_require__(0); -var Properties = __webpack_require__(11); +var Properties = __webpack_require__(12); var PropertyFactory = __webpack_require__(128); module.exports = Backbone.Model.extend({ @@ -37080,7 +37113,7 @@ module.exports = Backbone.Model.extend({ }, initialize: function initialize() { - var Properties = __webpack_require__(11); + var Properties = __webpack_require__(12); var properties = this.get('properties'); var value = this.get('value'); this.set('properties', properties instanceof Properties ? properties : new Properties(properties)); @@ -39610,7 +39643,7 @@ module.exports = Backbone.View.extend({ this.$el[active ? 'addClass' : 'removeClass'](pfx + 'active'); }, render: function render() { - var PropertiesView = __webpack_require__(13); + var PropertiesView = __webpack_require__(14); var propsConfig = this.propsConfig; var className = this.pfx + 'layer'; var model = this.model; @@ -39659,7 +39692,7 @@ module.exports = Property.extend({ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; -var Property = __webpack_require__(14); +var Property = __webpack_require__(15); module.exports = Property.extend({ events: function events() { @@ -40348,7 +40381,7 @@ module.exports = Backbone.View.extend({ /* WEBPACK VAR INJECTION */(function(_) { var Backbone = __webpack_require__(0); -var PropertiesView = __webpack_require__(13); +var PropertiesView = __webpack_require__(14); module.exports = Backbone.View.extend({ template: _.template('\n