diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fded357e..d38ea1e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.37.2](https://github.com/ajaxorg/ace/compare/v1.37.1...v1.37.2) (2025-01-06) + + +### Bug Fixes + +* fix return type of supportsFile modelist ([#5705](https://github.com/ajaxorg/ace/issues/5705)) ([de21d50](https://github.com/ajaxorg/ace/commit/de21d50656bd874e1626265b8853923cb8da7c8b)) + ### [1.37.1](https://github.com/ajaxorg/ace/compare/v1.37.0...v1.37.1) (2024-12-20) diff --git a/ace.d.ts b/ace.d.ts index 1f7f55587..c0fd155a1 100644 --- a/ace.d.ts +++ b/ace.d.ts @@ -972,7 +972,7 @@ declare module "ace-builds" { import { Range } from "ace-builds-internal/range"; import { UndoManager } from "ace-builds-internal/undomanager"; import { VirtualRenderer as Renderer } from "ace-builds-internal/virtual_renderer"; - export var version: "1.37.1"; + export var version: "1.37.2"; export { Range, Editor, EditSession, UndoManager, Renderer as VirtualRenderer }; } diff --git a/demo/emmet.html b/demo/emmet.html index 0d57f3253..8127bb273 100644 --- a/demo/emmet.html +++ b/demo/emmet.html @@ -23,7 +23,7 @@
- + diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 92617895c..d83954d1a 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -6595,308 +6595,6 @@ exports.StatusBar = StatusBar; }); -define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","ace/config","resources","resources","tabStops","resources","utils","actions"], function(require, exports, module){"use strict"; -var HashHandler = require("../keyboard/hash_handler").HashHandler; -var Editor = require("../editor").Editor; -var snippetManager = require("../snippets").snippetManager; -var Range = require("../range").Range; -var config = require("../config"); -var emmet, emmetPath; -var AceEmmetEditor = /** @class */ (function () { - function AceEmmetEditor() { - } - AceEmmetEditor.prototype.setupContext = function (editor) { - this.ace = editor; - this.indentation = editor.session.getTabString(); - if (!emmet) - emmet = window["emmet"]; - var resources = emmet.resources || emmet.require("resources"); - resources.setVariable("indentation", this.indentation); - this.$syntax = null; - this.$syntax = this.getSyntax(); - }; - AceEmmetEditor.prototype.getSelectionRange = function () { - var range = this.ace.getSelectionRange(); - var doc = this.ace.session.doc; - return { - start: doc.positionToIndex(range.start), - end: doc.positionToIndex(range.end) - }; - }; - AceEmmetEditor.prototype.createSelection = function (start, end) { - var doc = this.ace.session.doc; - this.ace.selection.setRange({ - start: doc.indexToPosition(start), - end: doc.indexToPosition(end) - }); - }; - AceEmmetEditor.prototype.getCurrentLineRange = function () { - var ace = this.ace; - var row = ace.getCursorPosition().row; - var lineLength = ace.session.getLine(row).length; - var index = ace.session.doc.positionToIndex({ row: row, column: 0 }); - return { - start: index, - end: index + lineLength - }; - }; - AceEmmetEditor.prototype.getCaretPos = function () { - var pos = this.ace.getCursorPosition(); - return this.ace.session.doc.positionToIndex(pos); - }; - AceEmmetEditor.prototype.setCaretPos = function (index) { - var pos = this.ace.session.doc.indexToPosition(index); - this.ace.selection.moveToPosition(pos); - }; - AceEmmetEditor.prototype.getCurrentLine = function () { - var row = this.ace.getCursorPosition().row; - return this.ace.session.getLine(row); - }; - AceEmmetEditor.prototype.replaceContent = function (value, start, end, noIndent) { - if (end == null) - end = start == null ? this.getContent().length : start; - if (start == null) - start = 0; - var editor = this.ace; - var doc = editor.session.doc; - var range = Range.fromPoints(doc.indexToPosition(start), doc.indexToPosition(end)); - editor.session.remove(range); - range.end = range.start; - value = this.$updateTabstops(value); - snippetManager.insertSnippet(editor, value); - }; - AceEmmetEditor.prototype.getContent = function () { - return this.ace.getValue(); - }; - AceEmmetEditor.prototype.getSyntax = function () { - if (this.$syntax) - return this.$syntax; - var syntax = this.ace.session.$modeId.split("/").pop(); - if (syntax == "html" || syntax == "php") { - var cursor = this.ace.getCursorPosition(); - var state = this.ace.session.getState(cursor.row); - if (typeof state != "string") - state = state[0]; - if (state) { - state = state.split("-"); - if (state.length > 1) - syntax = state[0]; - else if (syntax == "php") - syntax = "html"; - } - } - return syntax; - }; - AceEmmetEditor.prototype.getProfileName = function () { - var resources = emmet.resources || emmet.require("resources"); - switch (this.getSyntax()) { - case "css": return "css"; - case "xml": - case "xsl": - return "xml"; - case "html": - var profile = resources.getVariable("profile"); - if (!profile) - profile = this.ace.session.getLines(0, 2).join("").search(/]+XHTML/i) != -1 ? "xhtml" : "html"; - return profile; - default: - var mode = this.ace.session.$mode; - return mode.emmetConfig && mode.emmetConfig.profile || "xhtml"; - } - }; - AceEmmetEditor.prototype.prompt = function (title) { - return prompt(title); // eslint-disable-line no-alert - }; - AceEmmetEditor.prototype.getSelection = function () { - return this.ace.session.getTextRange(); - }; - AceEmmetEditor.prototype.getFilePath = function () { - return ""; - }; - AceEmmetEditor.prototype.$updateTabstops = function (value) { - var base = 1000; - var zeroBase = 0; - var lastZero = null; - var ts = emmet.tabStops || emmet.require('tabStops'); - var resources = emmet.resources || emmet.require("resources"); - var settings = resources.getVocabulary("user"); - var tabstopOptions = { - tabstop: function (data) { - var group = parseInt(data.group, 10); - var isZero = group === 0; - if (isZero) - group = ++zeroBase; - else - group += base; - var placeholder = data.placeholder; - if (placeholder) { - placeholder = ts.processText(placeholder, tabstopOptions); - } - var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}'; - if (isZero) { - lastZero = [data.start, result]; - } - return result; - }, - escape: function (ch) { - if (ch == '$') - return '\\$'; - if (ch == '\\') - return '\\\\'; - return ch; - } - }; - value = ts.processText(value, tabstopOptions); - if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) { - value += '${0}'; - } - else if (lastZero) { - var common = emmet.utils ? emmet.utils.common : emmet.require('utils'); - value = common.replaceSubstring(value, '${0}', lastZero[0], lastZero[1]); - } - return value; - }; - return AceEmmetEditor; -}()); -var keymap = { - expand_abbreviation: { "mac": "ctrl+alt+e", "win": "alt+e" }, - match_pair_outward: { "mac": "ctrl+d", "win": "ctrl+," }, - match_pair_inward: { "mac": "ctrl+j", "win": "ctrl+shift+0" }, - matching_pair: { "mac": "ctrl+alt+j", "win": "alt+j" }, - next_edit_point: "alt+right", - prev_edit_point: "alt+left", - toggle_comment: { "mac": "command+/", "win": "ctrl+/" }, - split_join_tag: { "mac": "shift+command+'", "win": "shift+ctrl+`" }, - remove_tag: { "mac": "command+'", "win": "shift+ctrl+;" }, - evaluate_math_expression: { "mac": "shift+command+y", "win": "shift+ctrl+y" }, - increment_number_by_1: "ctrl+up", - decrement_number_by_1: "ctrl+down", - increment_number_by_01: "alt+up", - decrement_number_by_01: "alt+down", - increment_number_by_10: { "mac": "alt+command+up", "win": "shift+alt+up" }, - decrement_number_by_10: { "mac": "alt+command+down", "win": "shift+alt+down" }, - select_next_item: { "mac": "shift+command+.", "win": "shift+ctrl+." }, - select_previous_item: { "mac": "shift+command+,", "win": "shift+ctrl+," }, - reflect_css_value: { "mac": "shift+command+r", "win": "shift+ctrl+r" }, - encode_decode_data_url: { "mac": "shift+ctrl+d", "win": "ctrl+'" }, - expand_abbreviation_with_tab: "Tab", - wrap_with_abbreviation: { "mac": "shift+ctrl+a", "win": "shift+ctrl+a" } -}; -var editorProxy = new AceEmmetEditor(); -exports.commands = new HashHandler(); -exports.runEmmetCommand = function runEmmetCommand(editor) { - if (this.action == "expand_abbreviation_with_tab") { - if (!editor.selection.isEmpty()) - return false; - var pos = editor.selection.lead; - var token = editor.session.getTokenAt(pos.row, pos.column); - if (token && /\btag\b/.test(token.type)) - return false; - } - try { - editorProxy.setupContext(editor); - var actions = emmet.actions || emmet.require("actions"); - if (this.action == "wrap_with_abbreviation") { - return setTimeout(function () { - actions.run("wrap_with_abbreviation", editorProxy); - }, 0); - } - var result = actions.run(this.action, editorProxy); - } - catch (e) { - if (!emmet) { - var loading = exports.load(runEmmetCommand.bind(this, editor)); - if (this.action == "expand_abbreviation_with_tab") - return false; - return loading; - } - editor._signal("changeStatus", typeof e == "string" ? e : e.message); - config.warn(e); - result = false; - } - return result; -}; -for (var command in keymap) { - exports.commands.addCommand({ - name: "emmet:" + command, - action: command, - bindKey: keymap[command], - exec: exports.runEmmetCommand, - multiSelectAction: "forEach" - }); -} -exports.updateCommands = function (editor, enabled) { - if (enabled) { - editor.keyBinding.addKeyboardHandler(exports.commands); - } - else { - editor.keyBinding.removeKeyboardHandler(exports.commands); - } -}; -exports.isSupportedMode = function (mode) { - if (!mode) - return false; - if (mode.emmetConfig) - return true; - var id = mode.$id || mode; - return /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(id); -}; -exports.isAvailable = function (editor, command) { - if (/(evaluate_math_expression|expand_abbreviation)$/.test(command)) - return true; - var mode = editor.session.$mode; - var isSupported = exports.isSupportedMode(mode); - if (isSupported && mode.$modes) { - try { - editorProxy.setupContext(editor); - if (/js|php/.test(editorProxy.getSyntax())) - isSupported = false; - } - catch (e) { } - } - return isSupported; -}; -var onChangeMode = function (e, target) { - var editor = target; - if (!editor) - return; - var enabled = exports.isSupportedMode(editor.session.$mode); - if (e.enableEmmet === false) - enabled = false; - if (enabled) - exports.load(); - exports.updateCommands(editor, enabled); -}; -exports.load = function (cb) { - if (typeof emmetPath !== "string") { - config.warn("script for emmet-core is not loaded"); - return false; - } - config.loadModule(emmetPath, function () { - emmetPath = null; - cb && cb(); - }); - return true; -}; -exports.AceEmmetEditor = AceEmmetEditor; -config.defineOptions(Editor.prototype, "editor", { - enableEmmet: { - set: function (val) { - this[val ? "on" : "removeListener"]("changeMode", onChangeMode); - onChangeMode({ enableEmmet: !!val }, this); - }, - value: true - } -}); -exports.setCore = function (e) { - if (typeof e == "string") - emmetPath = e; - else - emmet = e; -}; - -}); - define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(require, exports, module){var Range = require("../range").Range; var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/; function getWordIndex(doc, pos) { @@ -8271,7 +7969,7 @@ exports.commands = [{ }); -define("kitchen-sink/demo",["require","exports","module","ace/ext/rtl","ace/multi_select","kitchen-sink/inline_editor","kitchen-sink/dev_util","kitchen-sink/file_drop","ace/config","ace/lib/dom","ace/lib/net","ace/lib/lang","ace/lib/event","ace/theme/textmate","ace/edit_session","ace/undomanager","ace/keyboard/hash_handler","ace/virtual_renderer","ace/editor","ace/range","ace/ext/whitespace","kitchen-sink/doclist","kitchen-sink/layout","kitchen-sink/util","ace/ext/elastic_tabstops_lite","ace/incremental_search","kitchen-sink/token_tooltip","ace/config","ace/config","ace/tooltip","ace/marker_group","ace/worker/worker_client","ace/split","ace/ext/options","ace/autocomplete","ace/ext/statusbar","ace/ext/emmet","ace/placeholder","ace/snippets","ace/ext/language_tools","ace/ext/inline_autocomplete","ace/ext/beautify","ace/keyboard/keybinding","ace/commands/command_manager"], function(require, exports, module) {"use strict"; +define("kitchen-sink/demo",["require","exports","module","ace/ext/rtl","ace/multi_select","kitchen-sink/inline_editor","kitchen-sink/dev_util","kitchen-sink/file_drop","ace/config","ace/lib/dom","ace/lib/net","ace/lib/lang","ace/lib/event","ace/theme/textmate","ace/edit_session","ace/undomanager","ace/keyboard/hash_handler","ace/virtual_renderer","ace/editor","ace/range","ace/ext/whitespace","kitchen-sink/doclist","kitchen-sink/layout","kitchen-sink/util","ace/ext/elastic_tabstops_lite","ace/incremental_search","kitchen-sink/token_tooltip","ace/config","ace/config","ace/tooltip","ace/marker_group","ace/worker/worker_client","ace/split","ace/ext/options","ace/autocomplete","ace/ext/statusbar","ace/placeholder","ace/snippets","ace/ext/language_tools","ace/ext/inline_autocomplete","ace/ext/beautify","ace/keyboard/keybinding","ace/commands/command_manager"], function(require, exports, module) {"use strict"; require("ace/ext/rtl"); @@ -8749,13 +8447,6 @@ function synchroniseScrolling() { var StatusBar = require("ace/ext/statusbar").StatusBar; new StatusBar(env.editor, cmdLine.container); - -var Emmet = require("ace/ext/emmet"); -net.loadScript("https://cloud9ide.github.io/emmet-core/emmet.js", function() { - Emmet.setCore(window.emmet); - env.editor.setOption("enableEmmet", true); -}); - require("ace/placeholder").PlaceHolder; var snippetManager = require("ace/snippets").snippetManager; diff --git a/package.json b/package.json index 4ce246691..867f3464b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ace-builds", "main": "./src-noconflict/ace.js", "typings": "ace.d.ts", - "version": "1.37.1", + "version": "1.37.2", "description": "Ace (Ajax.org Cloud9 Editor)", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/src-min-noconflict/ace.js b/src-min-noconflict/ace.js index 43c5a1c47..3fc2edcbb 100644 --- a/src-min-noconflict/ace.js +++ b/src-min-noconflict/ace.js @@ -1,4 +1,4 @@ -(function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE = "ace",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;un.length)t=n.length;t-=e.length;var r=n.indexOf(e,t);return r!==-1&&r===t}),String.prototype.repeat||r(String.prototype,"repeat",function(e){var t="",n=this;while(e>0){e&1&&(t+=n);if(e>>=1)n+=n}return t}),String.prototype.includes||r(String.prototype,"includes",function(e,t){return this.indexOf(e,t)!=-1}),Object.assign||(Object.assign=function(e){if(e===undefined||e===null)throw new TypeError("Cannot convert undefined or null to object");var t=Object(e);for(var n=1;n