From ef64c2ab35b04c9aff1fd3ea0236a92b3701a93a Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Fri, 14 May 2021 18:35:11 -0400 Subject: [PATCH] Fix "add numbered list" styleSelectedText action Looks like I missed the `numberedLines` function used by the `orderedList` function in 60dea59815e10d453421117fa681a6474eb29ec8 --- .../core/js/src/common/utils/styleSelectedText.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/core/js/src/common/utils/styleSelectedText.ts b/framework/core/js/src/common/utils/styleSelectedText.ts index eacd5abc1..fc42c7c4b 100644 --- a/framework/core/js/src/common/utils/styleSelectedText.ts +++ b/framework/core/js/src/common/utils/styleSelectedText.ts @@ -260,3 +260,15 @@ function orderedList(textarea: HTMLTextAreaElement): SelectionRange { return { text, selectionStart, selectionEnd }; } + +function numberedLines(lines: string[]) { + let i; + let len; + let index; + const results = []; + for (index = i = 0, len = lines.length; i < len; index = ++i) { + const line = lines[index]; + results.push(`${index + 1}. ${line}`); + } + return results; +}