tui.editor icon indicating copy to clipboard operation
tui.editor copied to clipboard

Does the preview style change method exist?

Open wslp12 opened this issue 2 years ago โ€ข 3 comments

Summary

previewer์˜ ์Šคํƒ€์ผ์€ ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด div์— ํด๋ผ์Šค ์ด๋ฆ„๊ธฐ์ค€์œผ๋กœ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ณด์—ฌ ์ง€๋Š” ๊ฒƒ ์œผ๋กœ ์ถ”์ • ๋ฉ๋‹ˆ๋‹ค. ์ •๋ง ๋ฉ‹์ง„ ๊ธฐ๋ณธ ์Šคํƒ€์ผ์ž…๋‹ˆ๋‹ค ํ•˜์ง€๋งŒ ์ œ๊ฐ€ ๋‹ค๋ฅธ ํ˜•์‹์˜ ์Šคํƒ€์ผ์„ ์ œ๊ณต ํ•  ์ˆ˜๋„ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” api๊ฐ€ ์กด์žฌ ํ•ฉ๋‹ˆ๊นŒ ? ํ•ด๋‹น ์‚ฌ์ง„์— ๋‚˜์˜ค๋Š” div์˜ ํด๋ผ์Šค ์ด๋ฆ„์„ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์กด์žฌ ํ•ฉ๋‹ˆ๊นŒ ?

์ถ”๊ฐ€๋กœ prosemirror๊ธฐ์ค€์œผ๋กœ ์„ค๊ณ„๋˜์–ด ์žˆ๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ด๋Š”๋ฐ ๊ทธ๋ ‡๋‹ค๋ฉด ์—๋””ํ„ฐ์—(๋งˆํฌ๋‹ค์šด ๊ธฐ์ค€)์ž…๋ ฅ๋œ ํ…์ŠคํŠธ๋ฅผ ํ”„๋กœ์ฆˆ๋ฏธ๋Ÿฌ๋…ธ๋“œ jsonํ˜•์‹์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์กด์žฌํ• ๊นŒ์š” ?


As shown in the picture below, the preview is respectively class="toastui-editor-md-preview" class="toastui-editor-contents"

It seems to offer a style under the name of the class.

It's a very cool style that's I would like to offer Markdown in a different style format

Is there an API provided in relation to this?

Additionally, it seems to be designed based on the prosemirror standard Then is there a way to get the input text in json format in the editor (based on markdown)?

Screenshots

image

Version

Write the version of the Editor you are currently using.

Additional context

Add any other context about the problem here.

wslp12 avatar May 02 '22 12:05 wslp12

@wslp12 Sorry for the late reply.

What style do you want to apply? If you want to change the full style of the editor, you can only overwrite the CSS.

FYI, We offer a custom block (link)

(ADD) I want to know more detailed information about json format data.

jwlee1108 avatar May 11 '22 01:05 jwlee1108

@jwlee1108 It seems that the current editor is applying the style of the preview based on the container below.

<div class="toastui-editor-md-preview">
    <div class="toastui-editor-contents">
...
    </div>
</div>

Most editors with Markdown format seem to have designated containers as above and applied the style to the child elements below

I want to change the class name of that container.

The css I will use is not the name of the container toastui-editor-md-preview, toastui-editor-content.

I cannot change the css area

In addition, in the case of json format,

editor.getHTML();
editor.getMarkdown();

When executing the back and forth method (getHTML,getMarkdown), the string type is returned It's not the result of the string type I wonder if it is possible to return the Json format as well {"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","marks":[{"type":"em"}],"text":"asdfasdf"}]}]}


ํ˜„์žฌ ์‹œ๋„ํ•˜๊ณ  ์žˆ๋Š” ์ž‘์—…์€ ํ† ์Šค์˜ ํ”„๋ฆฌ๋ทฐ ์Šคํƒ€์ผ์„ ๋ณ€๊ฒฝํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค ํƒœ๊ทธ๋“ค์— ๋Œ€ํ•ด์„œ ์ปค์Šคํ…€์„ ์‹œ๋„ ํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๋ณดํŽธ์ ์œผ๋กœ ๋งˆํฌ๋‹ค์šด์— css๋ฅผ ์ž…ํž๋•Œ ์œ„ ์ฒ˜๋Ÿผ ์ปจํ…Œ์ด๋„ˆ์— class ๊ฐ€ ๋“ค์–ด๊ฐ€๊ณ  ๊ทธ ๊ธฐ์ค€์œผ๋กœ ์Šคํƒ€์ผ์„ ๋จน์ด๋Š”๋ฐ

ํ† ์Šค๋„ ๊ทธ๋ ‡๊ฒŒํ•˜๊ณ  ์žˆ๊ณ  ์ € ์—ญ์‹œ ๊ทธ๋Ÿฌ๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค

๋‹ค๋งŒ ์ œ๊ฐ€ ์‚ฌ์šฉํ•  cssํŒŒ์ผ์—๋Š” ์ด๋ฏธ ํŠน์ • ์ปจํ…Œ์ด๋„ˆ ํด๋ผ์Šค๊ฐ€ ์ง€์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค ์•„๋ž˜์ฒ˜๋Ÿผ์š”

<div class="git-md-preview">
    <div class="git-contents">
...
    </div>
</div>

๋”ฐ๋ผ์„œ ์ œ๊ฐ€ ์›ํ•˜๋Š”๊ฑด ํ”„๋ฆฌ๋ทฐ๋ฅผ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” ์ปจํ…Œ์ด๋„ˆ์˜ ํด๋ผ์Šค๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค (toastui-editor-md-preview, toastui-editor-content)

์ถ”๊ฐ€๋กœ json ํ˜•์‹์˜ ๊ฒฝ์šฐ๋Š”

editor.getHTML();
editor.getMarkdown();

์œ„ ๋’ค ๋ฉ”์„œ๋“œ๋ฅผ ์‹คํ–‰ ์‹œํ‚ฌ ๊ฒฝ์šฐ (getHTML,getMarkdown) string ํƒ€์ž…์„ ๋ฆฌํ„ดํ•˜๋Š”๋ฐ stringํƒ€์ž…์˜ ๊ฒฐ๊ณผ๋ฌผ์ด ์•„๋‹ˆ๋ผ ์•„๋ž˜์™€ ๊ฐ™์€ json ํ˜•์‹๋„ ๋ฆฌํ„ด์ด ๊ฐ€๋Šฅํ•œ์ง€ ๊ถ๊ธˆํ•˜๋„ค์š” {"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","marks":[{"type":"em"}],"text":"asdfasdf"}]}]}

wslp12 avatar May 24 '22 12:05 wslp12

This issue has been automatically marked as inactive because there hasnโ€™t been much going on it lately. It is going to be closed after 7 days. Thanks!

stale[bot] avatar Jul 31 '22 11:07 stale[bot]

I have the same issue, is it possible to pass in parameters to customize the classname of the container?

OrangeHeap avatar Nov 07 '22 11:11 OrangeHeap

I decided to handle it another way. Thank you!

wslp12 avatar Oct 16 '23 06:10 wslp12