@bigbinary/neeto-editor 1.43.27 → 1.43.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15077,7 +15077,7 @@ var common = hljs;
|
|
|
15077
15077
|
var HighlightJS = /*@__PURE__*/getDefaultExportFromCjs(common);
|
|
15078
15078
|
|
|
15079
15079
|
/* eslint-disable @bigbinary/neeto/file-name-and-export-name-standards */
|
|
15080
|
-
var highlightLinesScriptCDNPath = "
|
|
15080
|
+
var highlightLinesScriptCDNPath = "https://cdn.jsdelivr.net/gh/TRSasasusu/highlightjs-highlight-lines.js@1.2.0/highlightjs-highlight-lines.min.js";
|
|
15081
15081
|
var getHighlightedLines = function getHighlightedLines(preNode, codeNode) {
|
|
15082
15082
|
var _preNode$getAttribute, _highlightedLines$spl, _highlightedLines$spl2;
|
|
15083
15083
|
var highlightedLines = (_preNode$getAttribute = preNode === null || preNode === void 0 ? void 0 : preNode.getAttribute("data-highlighted-lines")) !== null && _preNode$getAttribute !== void 0 ? _preNode$getAttribute : codeNode === null || codeNode === void 0 ? void 0 : codeNode.getAttribute("data-highlighted-lines");
|
|
@@ -15118,29 +15118,38 @@ var addCopyToClipboardButton = function addCopyToClipboardButton(codeElement) {
|
|
|
15118
15118
|
});
|
|
15119
15119
|
codeElement.parentNode.appendChild(copyButton);
|
|
15120
15120
|
};
|
|
15121
|
-
function
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15121
|
+
var applyDecorations = function applyDecorations() {
|
|
15122
|
+
document.querySelectorAll("pre code").forEach(function (codeElement) {
|
|
15123
|
+
var preElement = codeElement.closest("pre");
|
|
15124
|
+
HighlightJS.highlightElement(codeElement);
|
|
15125
|
+
addCopyToClipboardButton(codeElement);
|
|
15126
|
+
var linesToHighlight = getHighlightedLines(preElement, codeElement);
|
|
15127
|
+
var highlightLinesOptions = linesToHighlight.filter(function (line) {
|
|
15128
|
+
return line > 0;
|
|
15129
|
+
}).map(function (line) {
|
|
15130
|
+
return {
|
|
15131
|
+
start: line,
|
|
15132
|
+
end: line,
|
|
15133
|
+
color: "rgba(255, 255, 0, 0.2)"
|
|
15134
|
+
};
|
|
15135
|
+
});
|
|
15136
|
+
HighlightJS.highlightLinesElement(codeElement, highlightLinesOptions);
|
|
15134
15137
|
});
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
+
};
|
|
15139
|
+
var checkContextAndApplyDecorations = function checkContextAndApplyDecorations() {
|
|
15140
|
+
// Don't have to load the script if the `hljs.highlightLinesElement` is in the context.
|
|
15141
|
+
if (HighlightJS.highlightLinesElement) return applyDecorations();
|
|
15138
15142
|
var script = document.createElement("script");
|
|
15139
15143
|
script.src = highlightLinesScriptCDNPath;
|
|
15140
15144
|
script.async = true;
|
|
15141
15145
|
document.head.appendChild(script);
|
|
15142
|
-
script.addEventListener("load",
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
+
return script.addEventListener("load", applyDecorations);
|
|
15147
|
+
};
|
|
15148
|
+
(function (_window$neetoEditor) {
|
|
15149
|
+
if (document.readyState === "loading") {
|
|
15150
|
+
document.addEventListener("DOMContentLoaded", checkContextAndApplyDecorations);
|
|
15151
|
+
} else checkContextAndApplyDecorations();
|
|
15152
|
+
window.neetoEditor = (_window$neetoEditor = window.neetoEditor) !== null && _window$neetoEditor !== void 0 ? _window$neetoEditor : {};
|
|
15153
|
+
window.neetoEditor.applyCodeblockDecorations = checkContextAndApplyDecorations;
|
|
15154
|
+
})();
|
|
15146
15155
|
//# sourceMappingURL=codeBlockHighlight.js.map
|