Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Mirror assets #8125

Merged
merged 2 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace OrchardCore.Resources
public class ResourceManifest : IResourceManifestProvider
{
// CDNs
private const string jsDelivrUrl = "https://cdnjs.cloudflare.com/ajax/libs/";
private const string jsDelivrUrl = "https://cdn.jsdelivr.net/npm/";
// Versions
private const string codeMirrorVersion = "5.59.0";
// URLs
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
// declare global: DOMRect
(function (mod) {
if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) == "object" && (typeof module === "undefined" ? "undefined" : _typeof(module)) == "object") // CommonJS
mod(require("../../lib/codemirror"));else if (typeof define == "function" && define.amd) // AMD
Expand Down Expand Up @@ -96,7 +97,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
CodeMirror.signal(data, "pick", completion);
self.cm.scrollIntoView();
});
this.close();

if (this.options.closeOnPick) {
this.close();
}
},
cursorActivity: function cursorActivity() {
if (this.debounce) {
Expand All @@ -114,7 +118,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
line = this.cm.getLine(pos.line);

if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch || pos.ch < identStart.ch || this.cm.somethingSelected() || !pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1))) {
this.close();
if (this.options.closeOnCursorActivity) {
this.close();
}
} else {
var self = this;
this.debounce = requestAnimationFrame(function () {
Expand Down Expand Up @@ -283,10 +289,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
container.appendChild(hints);
var box = hints.getBoundingClientRect(),
overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1;
var startScroll = cm.getScrollInfo();
var box = completion.options.moveOnOverlap ? hints.getBoundingClientRect() : new DOMRect();
var scrolls = completion.options.paddingForScrollbar ? hints.scrollHeight > hints.clientHeight + 1 : false; // Compute in the timeout to avoid reflow on init

var startScroll;
setTimeout(function () {
startScroll = cm.getScrollInfo();
});
var overlapY = box.bottom - winH;

if (overlapY > 0) {
var height = box.bottom - box.top,
Expand Down Expand Up @@ -385,8 +395,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
setTimeout(function () {
cm.focus();
}, 20);
});
this.scrollToActive();
}); // The first hint doesn't need to be scrolled to on init

var selectedHintRange = this.getSelectedHintRange();

if (selectedHintRange.from !== 0 || selectedHintRange.to !== 0) {
this.scrollToActive();
}

CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
return true;
}
Expand Down Expand Up @@ -430,14 +446,21 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
},
scrollToActive: function scrollToActive() {
var margin = this.completion.options.scrollMargin || 0;
var node1 = this.hints.childNodes[Math.max(0, this.selectedHint - margin)];
var node2 = this.hints.childNodes[Math.min(this.data.list.length - 1, this.selectedHint + margin)];
var selectedHintRange = this.getSelectedHintRange();
var node1 = this.hints.childNodes[selectedHintRange.from];
var node2 = this.hints.childNodes[selectedHintRange.to];
var firstNode = this.hints.firstChild;
if (node1.offsetTop < this.hints.scrollTop) this.hints.scrollTop = node1.offsetTop - firstNode.offsetTop;else if (node2.offsetTop + node2.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) this.hints.scrollTop = node2.offsetTop + node2.offsetHeight - this.hints.clientHeight + firstNode.offsetTop;
},
screenAmount: function screenAmount() {
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
},
getSelectedHintRange: function getSelectedHintRange() {
var margin = this.completion.options.scrollMargin || 0;
return {
from: Math.max(0, this.selectedHint - margin),
to: Math.min(this.data.list.length - 1, this.selectedHint + margin)
};
}
};

Expand Down Expand Up @@ -533,11 +556,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
completeSingle: true,
alignWithWord: true,
closeCharacters: /[\s()\[\]{};:>,]/,
closeOnCursorActivity: true,
closeOnPick: true,
closeOnUnfocus: true,
completeOnSingleClick: true,
container: null,
customKeys: null,
extraKeys: null
extraKeys: null,
paddingForScrollbar: true,
moveOnOverlap: true
};
CodeMirror.defineOption("hintOptions", null);
});

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
var safari = /Apple Computer/.test(navigator.vendor);
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
var phantom = /PhantomJS/.test(userAgent);
var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
var ios = !edge && /AppleWebKit/.test(userAgent) && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
var android = /Android/.test(userAgent); // This is woefully incomplete. Suggestions for alternative methods welcome.

var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
Expand Down Expand Up @@ -14649,6 +14649,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi

CodeMirror.fromTextArea = fromTextArea;
addLegacyProps(CodeMirror);
CodeMirror.version = "5.58.3";
CodeMirror.version = "5.59.0";
return CodeMirror;
});

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
if (value == "|" || value == "&") return cont(typeexpr);
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType);
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType);
if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType);
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType);
if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr);
}
Expand All @@ -806,6 +806,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
if (type == "=>") return cont(typeexpr);
}

function typeprops(type) {
if (type == "}") return cont();
if (type == "," || type == ";") return cont(typeprops);
return pass(typeprop, typeprops);
}

function typeprop(type, value) {
if (type == "variable" || cx.style == "keyword") {
cx.marked = "property";
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
background-color: transparent; /* The little square between H and V scrollbars */
}

/* GUTTER */
Expand Down
Loading