mirror of
https://github.com/neocities/neocities.git
synced 2025-05-13 16:07:19 +02:00
improve underline links, update ace, add more ace themes
This commit is contained in:
parent
37cac9d1bd
commit
7788437c33
467 changed files with 324936 additions and 321 deletions
|
@ -1,4 +1,116 @@
|
|||
define("ace/ext/rtl",["require","exports","module","ace/editor","ace/config"],function(e,t,n){"use strict";function s(e,t){var n=t.getSelection().lead;t.session.$bidiHandler.isRtlLine(n.row)&&n.column===0&&(t.session.$bidiHandler.isMoveLeftOperation&&n.row>0?t.getSelection().moveCursorTo(n.row-1,t.session.getLine(n.row-1).length):t.getSelection().isEmpty()?n.column+=1:n.setPosition(n.row,n.column+1))}function o(e){e.editor.session.$bidiHandler.isMoveLeftOperation=/gotoleft|selectleft|backspace|removewordleft/.test(e.command.name)}function u(e,t){var n=t.session;n.$bidiHandler.currentRow=null;if(n.$bidiHandler.isRtlLine(e.start.row)&&e.action==="insert"&&e.lines.length>1)for(var r=e.start.row;r<e.end.row;r++)n.getLine(r+1).charAt(0)!==n.$bidiHandler.RLE&&(n.doc.$lines[r+1]=n.$bidiHandler.RLE+n.getLine(r+1))}function a(e,t){var n=t.session,r=n.$bidiHandler,i=t.$textLayer.$lines.cells,s=t.layerConfig.width-t.layerConfig.padding+"px";i.forEach(function(e){var t=e.element.style;r&&r.isRtlLine(e.row)?(t.direction="rtl",t.textAlign="right",t.width=s):(t.direction="",t.textAlign="",t.width="")})}function f(e){function n(e){var t=e.element.style;t.direction=t.textAlign=t.width=""}var t=e.$textLayer.$lines;t.cells.forEach(n),t.cellCache.forEach(n)}var r=[{name:"leftToRight",bindKey:{win:"Ctrl-Alt-Shift-L",mac:"Command-Alt-Shift-L"},exec:function(e){e.session.$bidiHandler.setRtlDirection(e,!1)},readOnly:!0},{name:"rightToLeft",bindKey:{win:"Ctrl-Alt-Shift-R",mac:"Command-Alt-Shift-R"},exec:function(e){e.session.$bidiHandler.setRtlDirection(e,!0)},readOnly:!0}],i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{rtlText:{set:function(e){e?(this.on("change",u),this.on("changeSelection",s),this.renderer.on("afterRender",a),this.commands.on("exec",o),this.commands.addCommands(r)):(this.off("change",u),this.off("changeSelection",s),this.renderer.off("afterRender",a),this.commands.off("exec",o),this.commands.removeCommands(r),f(this.renderer)),this.renderer.updateFull()}},rtl:{set:function(e){this.session.$bidiHandler.$isRtl=e,e?(this.setOption("rtlText",!1),this.renderer.on("afterRender",a),this.session.$bidiHandler.seenBidi=!0):(this.renderer.off("afterRender",a),f(this.renderer)),this.renderer.updateFull()}}})}); (function() {
|
||||
define("ace/ext/rtl",["require","exports","module","ace/editor","ace/config"], function(require, exports, module){"use strict";
|
||||
var commands = [{
|
||||
name: "leftToRight",
|
||||
bindKey: { win: "Ctrl-Alt-Shift-L", mac: "Command-Alt-Shift-L" },
|
||||
exec: function (editor) {
|
||||
editor.session.$bidiHandler.setRtlDirection(editor, false);
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "rightToLeft",
|
||||
bindKey: { win: "Ctrl-Alt-Shift-R", mac: "Command-Alt-Shift-R" },
|
||||
exec: function (editor) {
|
||||
editor.session.$bidiHandler.setRtlDirection(editor, true);
|
||||
},
|
||||
readOnly: true
|
||||
}];
|
||||
var Editor = require("../editor").Editor;
|
||||
require("../config").defineOptions(Editor.prototype, "editor", {
|
||||
rtlText: {
|
||||
set: function (val) {
|
||||
if (val) {
|
||||
this.on("change", onChange);
|
||||
this.on("changeSelection", onChangeSelection);
|
||||
this.renderer.on("afterRender", updateLineDirection);
|
||||
this.commands.on("exec", onCommandEmitted);
|
||||
this.commands.addCommands(commands);
|
||||
}
|
||||
else {
|
||||
this.off("change", onChange);
|
||||
this.off("changeSelection", onChangeSelection);
|
||||
this.renderer.off("afterRender", updateLineDirection);
|
||||
this.commands.off("exec", onCommandEmitted);
|
||||
this.commands.removeCommands(commands);
|
||||
clearTextLayer(this.renderer);
|
||||
}
|
||||
this.renderer.updateFull();
|
||||
}
|
||||
},
|
||||
rtl: {
|
||||
set: function (val) {
|
||||
this.session.$bidiHandler.$isRtl = val;
|
||||
if (val) {
|
||||
this.setOption("rtlText", false);
|
||||
this.renderer.on("afterRender", updateLineDirection);
|
||||
this.session.$bidiHandler.seenBidi = true;
|
||||
}
|
||||
else {
|
||||
this.renderer.off("afterRender", updateLineDirection);
|
||||
clearTextLayer(this.renderer);
|
||||
}
|
||||
this.renderer.updateFull();
|
||||
}
|
||||
}
|
||||
});
|
||||
function onChangeSelection(e, editor) {
|
||||
var lead = editor.getSelection().lead;
|
||||
if (editor.session.$bidiHandler.isRtlLine(lead.row)) {
|
||||
if (lead.column === 0) {
|
||||
if (editor.session.$bidiHandler.isMoveLeftOperation && lead.row > 0) {
|
||||
editor.getSelection().moveCursorTo(lead.row - 1, editor.session.getLine(lead.row - 1).length);
|
||||
}
|
||||
else {
|
||||
if (editor.getSelection().isEmpty())
|
||||
lead.column += 1;
|
||||
else
|
||||
lead.setPosition(lead.row, lead.column + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function onCommandEmitted(commadEvent) {
|
||||
commadEvent.editor.session.$bidiHandler.isMoveLeftOperation = /gotoleft|selectleft|backspace|removewordleft/.test(commadEvent.command.name);
|
||||
}
|
||||
function onChange(delta, editor) {
|
||||
var session = editor.session;
|
||||
session.$bidiHandler.currentRow = null;
|
||||
if (session.$bidiHandler.isRtlLine(delta.start.row) && delta.action === 'insert' && delta.lines.length > 1) {
|
||||
for (var row = delta.start.row; row < delta.end.row; row++) {
|
||||
if (session.getLine(row + 1).charAt(0) !== session.$bidiHandler.RLE)
|
||||
session.doc.$lines[row + 1] = session.$bidiHandler.RLE + session.getLine(row + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function updateLineDirection(e, renderer) {
|
||||
var session = renderer.session;
|
||||
var $bidiHandler = session.$bidiHandler;
|
||||
var cells = renderer.$textLayer.$lines.cells;
|
||||
var width = renderer.layerConfig.width - renderer.layerConfig.padding + "px";
|
||||
cells.forEach(function (cell) {
|
||||
var style = cell.element.style;
|
||||
if ($bidiHandler && $bidiHandler.isRtlLine(cell.row)) {
|
||||
style.direction = "rtl";
|
||||
style.textAlign = "right";
|
||||
style.width = width;
|
||||
}
|
||||
else {
|
||||
style.direction = "";
|
||||
style.textAlign = "";
|
||||
style.width = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
function clearTextLayer(renderer) {
|
||||
var lines = renderer.$textLayer.$lines;
|
||||
lines.cells.forEach(clear);
|
||||
lines.cellCache.forEach(clear);
|
||||
function clear(cell) {
|
||||
var style = cell.element.style;
|
||||
style.direction = style.textAlign = style.width = "";
|
||||
}
|
||||
}
|
||||
|
||||
}); (function() {
|
||||
window.require(["ace/ext/rtl"], function(m) {
|
||||
if (typeof module == "object" && typeof exports == "object" && module) {
|
||||
module.exports = m;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue