From 4d054b2711ffe3ab402e0bc4757d15bc8e517384 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 8 Aug 2022 15:40:01 +0200 Subject: [PATCH] Remove deprecated Prism.wscSplitIntoLines This method was primarily meant for internal use, hijacks the original Prism object, is not TypeScript and has a clean replacement in Prism/Helper.ts. --- ts/WoltLabSuite/Core/Prism.js | 40 ------------------- .../files/js/WoltLabSuite/Core/Prism.js | 40 ------------------- 2 files changed, 80 deletions(-) diff --git a/ts/WoltLabSuite/Core/Prism.js b/ts/WoltLabSuite/Core/Prism.js index 68b0954371..eb62cf7cad 100644 --- a/ts/WoltLabSuite/Core/Prism.js +++ b/ts/WoltLabSuite/Core/Prism.js @@ -9,45 +9,5 @@ window.Prism = window.Prism || {}; window.Prism.manual = true; define(['prism/prism'], function () { - /** - * @deprecated 5.4 - Use WoltLabSuite/Core/Prism/Helper#splitIntoLines. - */ - Prism.wscSplitIntoLines = function (container) { - var frag = document.createDocumentFragment(); - var lineNo = 1; - var it, node, line; - function newLine() { - var line = elCreate('span'); - elData(line, 'number', lineNo++); - frag.appendChild(line); - return line; - } - // IE11 expects a fourth, non-standard, parameter (entityReferenceExpansion) and a valid function as third - it = document.createNodeIterator(container, NodeFilter.SHOW_TEXT, function () { - return NodeFilter.FILTER_ACCEPT; - }, false); - line = newLine(lineNo); - while (node = it.nextNode()) { - node.data.split(/\r?\n/).forEach(function (codeLine, index) { - var current, parent; - // We are behind a newline, insert \n and create new container. - if (index >= 1) { - line.appendChild(document.createTextNode("\n")); - line = newLine(lineNo); - } - current = document.createTextNode(codeLine); - // Copy hierarchy (to preserve CSS classes). - parent = node.parentNode; - while (parent !== container) { - var clone = parent.cloneNode(false); - clone.appendChild(current); - current = clone; - parent = parent.parentNode; - } - line.appendChild(current); - }); - } - return frag; - }; return Prism; }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Prism.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Prism.js index 68b0954371..eb62cf7cad 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Prism.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Prism.js @@ -9,45 +9,5 @@ window.Prism = window.Prism || {}; window.Prism.manual = true; define(['prism/prism'], function () { - /** - * @deprecated 5.4 - Use WoltLabSuite/Core/Prism/Helper#splitIntoLines. - */ - Prism.wscSplitIntoLines = function (container) { - var frag = document.createDocumentFragment(); - var lineNo = 1; - var it, node, line; - function newLine() { - var line = elCreate('span'); - elData(line, 'number', lineNo++); - frag.appendChild(line); - return line; - } - // IE11 expects a fourth, non-standard, parameter (entityReferenceExpansion) and a valid function as third - it = document.createNodeIterator(container, NodeFilter.SHOW_TEXT, function () { - return NodeFilter.FILTER_ACCEPT; - }, false); - line = newLine(lineNo); - while (node = it.nextNode()) { - node.data.split(/\r?\n/).forEach(function (codeLine, index) { - var current, parent; - // We are behind a newline, insert \n and create new container. - if (index >= 1) { - line.appendChild(document.createTextNode("\n")); - line = newLine(lineNo); - } - current = document.createTextNode(codeLine); - // Copy hierarchy (to preserve CSS classes). - parent = node.parentNode; - while (parent !== container) { - var clone = parent.cloneNode(false); - clone.appendChild(current); - current = clone; - parent = parent.parentNode; - } - line.appendChild(current); - }); - } - return frag; - }; return Prism; }); -- 2.20.1