Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
colourYellow
title릴리즈 Release 2.3.0 이상
Synap Editor에서 정규식에 맞는 텍스트 정보를 가져 옵니다
or Above

Load the text information that corresponds with the given regular expression from Synap Editor.


Parameters:

NameTypeDescription
regexObject가져올 텍스트 정규식Regular expression for the text to load



Return:

TypeAttributeDescription
Array[
    { id: "paragraphId1", text: "+제1조Article 1 (목적Purpose)" },
    { id: "paragraphId2", text: "+제2조Article 2 (정의Definition)" },
    ....
]
text가 위치한 paragraph id와 텍스트paragraph id of the paragraph in which the text is located and the text



Example:

Code Block
languagejs
themeEmacs
var textInfoList = editor.getTextByRegex(/\+제\d+조\([가-힣\s\d\w]+\)/g);

활용 예

getTextByRegex 활용하여 북마크 삽입 예제

...



...

Example


Sample of Inserting a Bookmark through getTextByRegex

Move the caret using "setCaretById" Selection API that moves the caret based on the paragraph ID and insert the bookmark using "insertBookmark" bookmark inserting EDIT API, with the text found by the regular expression as the bookmark ID.


Example:

Code Block
languagejs
themeEmacs
var textInfoList = editor.getTextByRegex(/\+제\d+조\([가-힣\s\d\w]+\)/g);
/* return value
[
    { id: "paragraphId1", text: "+제1조(목적Article 1 (Purpose)" },
    { id: "paragraphId2", text: "+제2조(정의Article 2 (Definition)" },
    ....
]
*/


textInfoList.forEach(textInfo => {
	editor.execCommand('setCaretById', textInfo.id);
	editor.execCommand('insertBookmark', textInfo.text);
});
  • 생성된 북마크 활용하여 목차 하이퍼링크 생성 가능You may create a table of contents hyperlinks using the generated bookmarks.