에디터
서식 있는 텍스트 에디터의 틀로, 도구 모음과 문서, 그리고 그 상태를 제공합니다.
이 페이지의 내용
에디터는 서식 있는 텍스트 필드의 틀입니다. 입력 필드의 오목한 영역, 그 위쪽에 평평하게 놓인 도구 모음, 그 아래의 문서로 구성됩니다. 문서 모델, 선택 영역, 실행 기록, 키 입력 등 실제 편집 작업은 Tiptap이나 ProseMirror 같은 엔진이 담당합니다. 엔진은 editor-document를 편집 가능하게 만들고, 렌더링하는 블록에 에디터의 클래스를 작성합니다. 서식 있는 텍스트에서 Tiptap을 에디터에 적용하는 방법을 설명합니다.
에디터
<div class="field w-full max-w(560) mx-auto"> <span id="notes-label">Release notes</span> <div class="editor" style="--editor-rows: 5"> <div class="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="true"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M4.6667 3H8.3333C12.3333 3 12.3333 7.6667 8.3333 7.6667H4.6667M4.6667 3V13H9C13.3333 13 13.3333 7.6667 9 7.6667" /> </svg> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6.6667 3L12.6667 3" /><path d="M3.3333 13L9.3333 13" /><path d="M9.6667 3L6.3333 13" stroke-linecap="butt" /> </svg> </button> <span class="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="3" cy="4" r="0.5" fill="currentColor" stroke="none" /><path d="M6 4L13.5 4" /><circle cx="3" cy="8" r="0.5" fill="currentColor" stroke="none" /><path d="M6 8L13.5 8" /><circle cx="3" cy="12" r="0.5" fill="currentColor" stroke="none" /><path d="M6 12L13.5 12" /> </svg> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M9 4.3333L10 3.3333C11.0125 2.3208 12.6541 2.3208 13.6667 3.3333C14.6792 4.3459 14.6792 5.9875 13.6667 7L11.6667 9C10.6541 10.0125 9.0125 10.0125 8 9" /><path d="M9 4.3333L10 3.3333C11.0125 2.3208 12.6541 2.3208 13.6667 3.3333C14.6792 4.3459 14.6792 5.9875 13.6667 7L11.6667 9C10.6541 10.0125 9.0125 10.0125 8 9" transform="rotate(180 8 8)" /> </svg> </button> </div> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="notes-label" contenteditable="true"> <h2 class="editor-heading">Version 0.4</h2> <p class="editor-paragraph"> Category colors arrive: <strong>twenty-three palettes</strong>, each with a surface, a text, a line and a mark. </p> </div> </div></div>import BoldIcon from '@master/icons-react/native/16/soft/bold'import ItalicIcon from '@master/icons-react/native/16/soft/italic'import ListIcon from '@master/icons-react/native/16/soft/list'import LinkIcon from '@master/icons-react/native/16/soft/link'<div className="field w-full max-w(560) mx-auto"> <span id="notes-label">Release notes</span> <div className="editor" style={{ '--editor-rows': '5' } as React.CSSProperties}> <div className="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="true"> <BoldIcon className="icon" /> </button> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false"> <ItalicIcon className="icon" /> </button> <span className="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false"> <ListIcon className="icon" /> </button> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false"> <LinkIcon className="icon" /> </button> </div> <div className="editor-document" role="textbox" aria-multiline="true" aria-labelledby="notes-label" contentEditable="true"> <h2 className="editor-heading">Version 0.4</h2> <p className="editor-paragraph"> Category colors arrive: <strong>twenty-three palettes</strong>, each with a surface, a text, a line and a mark. </p> </div> </div></div><script> import BoldIcon from '@master/icons-svelte/native/16/soft/bold' import ItalicIcon from '@master/icons-svelte/native/16/soft/italic' import ListIcon from '@master/icons-svelte/native/16/soft/list' import LinkIcon from '@master/icons-svelte/native/16/soft/link'</script><div class="field w-full max-w(560) mx-auto"> <span id="notes-label">Release notes</span> <div class="editor" style="--editor-rows: 5"> <div class="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="true"> <BoldIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false"> <ItalicIcon class="icon" /> </button> <span class="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false"> <ListIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false"> <LinkIcon class="icon" /> </button> </div> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="notes-label" contenteditable="true"> <h2 class="editor-heading">Version 0.4</h2> <p class="editor-paragraph"> Category colors arrive: <strong>twenty-three palettes</strong>, each with a surface, a text, a line and a mark. </p> </div> </div></div><script setup>import BoldIcon from '@master/icons-vue/native/16/soft/bold'import ItalicIcon from '@master/icons-vue/native/16/soft/italic'import ListIcon from '@master/icons-vue/native/16/soft/list'import LinkIcon from '@master/icons-vue/native/16/soft/link'</script><template> <div class="field w-full max-w(560) mx-auto"> <span id="notes-label">Release notes</span> <div class="editor" style="--editor-rows: 5"> <div class="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="true"> <BoldIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false"> <ItalicIcon class="icon" /> </button> <span class="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false"> <ListIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false"> <LinkIcon class="icon" /> </button> </div> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="notes-label" contenteditable="true"> <h2 class="editor-heading">Version 0.4</h2> <p class="editor-paragraph"> Category colors arrive: <strong>twenty-three palettes</strong>, each with a surface, a text, a line and a mark. </p> </div> </div> </div></template>엔진이 없으면 이 미리보기의 문서는 브라우저 자체의 contenteditable입니다. 텍스트는 입력할 수 있지만 구조는 만들 수 없으며, 도구 모음도 동작하지 않습니다.
#틀
- 필드입니다. 오목한 영역, 호버, 포커스 링, 위험 상태의 가장자리, 비활성화 시의 잉크 색은 모두 입력 필드와 같으므로, 서식 있는 텍스트 필드가 주변 필드와 같은 방식으로 보입니다. 틀을 강조하는 포커스는 문서의 포커스이므로, 도구 모음 안에서 이동할 때는 틀이 강조되지 않습니다.
- 도구 모음은 띠 형태입니다. 도구 모음에
editor-toolbar를 지정하면 오목한 영역의 위쪽에 안쪽 여백 하나만큼 들어가 평평하게 놓이므로, 모서리가 오목한 영역의 모서리 안에 맞물리고 아래에는 가는 구분선이 생깁니다. 에디터가 좁으면 줄바꿈됩니다. 도구 모음 동작은 도구 모음을 Tab 키 이동 순서에서 한 지점으로 만들고 방향키로 이동할 수 있게 합니다. - 문서는 내용에 따라 늘어납니다. 비어 있을 때는
--editor-rows로 정한 줄 수(기본값 6줄)만큼 표시되고,--editor-max-rows로 정한 줄 수(기본값 18줄)까지 늘어난 뒤에는 틀 안에서 스크롤됩니다.
#문서에 담기는 내용
스타일시트는 요소를 직접 선택하지 않습니다. 엔진이 각 블록에 클래스를 작성하며, 에디터 안에 있는 이 클래스들에만 스타일이 적용됩니다. 페이지용 타이포그래피가 아닙니다.
문서에 담기는 내용
<div class="editor w-full max-w(560) mx-auto"> <div class="editor-document" role="textbox" aria-multiline="true" aria-label="Document" contenteditable="true"> <h2 class="editor-heading">A heading</h2> <p class="editor-paragraph"> A paragraph with <a class="editor-link" href="#content">a link</a>, <em>emphasis</em> and <code class="code">inline code</code>. </p> <h3 class="editor-subheading">A subheading</h3> <ul class="editor-list"> <li class="editor-item"> <p class="editor-paragraph">A list with bullets</p> </li> <li class="editor-item"> <p class="editor-paragraph">Its markers in the muted ink</p> </li> </ul> <ol class="editor-list editor-list-numbered"> <li class="editor-item"> <p class="editor-paragraph">A list with numbers</p> </li> <li class="editor-item"> <p class="editor-paragraph">On an ordered list</p> </li> </ol> <blockquote class="editor-quote"> <p class="editor-paragraph">A quotation, a step quieter.</p> </blockquote> <hr class="editor-rule"> <p class="editor-paragraph">And a paragraph after a rule.</p> </div></div><div className="editor w-full max-w(560) mx-auto"> <div className="editor-document" role="textbox" aria-multiline="true" aria-label="Document" contentEditable="true"> <h2 className="editor-heading">A heading</h2> <p className="editor-paragraph"> A paragraph with <a className="editor-link" href="#content">a link</a>, <em>emphasis</em> and <code className="code">inline code</code>. </p> <h3 className="editor-subheading">A subheading</h3> <ul className="editor-list"> <li className="editor-item"> <p className="editor-paragraph">A list with bullets</p> </li> <li className="editor-item"> <p className="editor-paragraph">Its markers in the muted ink</p> </li> </ul> <ol className="editor-list editor-list-numbered"> <li className="editor-item"> <p className="editor-paragraph">A list with numbers</p> </li> <li className="editor-item"> <p className="editor-paragraph">On an ordered list</p> </li> </ol> <blockquote className="editor-quote"> <p className="editor-paragraph">A quotation, a step quieter.</p> </blockquote> <hr className="editor-rule" /> <p className="editor-paragraph">And a paragraph after a rule.</p> </div></div><div class="editor w-full max-w(560) mx-auto"> <div class="editor-document" role="textbox" aria-multiline="true" aria-label="Document" contenteditable="true"> <h2 class="editor-heading">A heading</h2> <p class="editor-paragraph"> A paragraph with <a class="editor-link" href="#content">a link</a>, <em>emphasis</em> and <code class="code">inline code</code>. </p> <h3 class="editor-subheading">A subheading</h3> <ul class="editor-list"> <li class="editor-item"> <p class="editor-paragraph">A list with bullets</p> </li> <li class="editor-item"> <p class="editor-paragraph">Its markers in the muted ink</p> </li> </ul> <ol class="editor-list editor-list-numbered"> <li class="editor-item"> <p class="editor-paragraph">A list with numbers</p> </li> <li class="editor-item"> <p class="editor-paragraph">On an ordered list</p> </li> </ol> <blockquote class="editor-quote"> <p class="editor-paragraph">A quotation, a step quieter.</p> </blockquote> <hr class="editor-rule"> <p class="editor-paragraph">And a paragraph after a rule.</p> </div></div><template> <div class="editor w-full max-w(560) mx-auto"> <div class="editor-document" role="textbox" aria-multiline="true" aria-label="Document" contenteditable="true"> <h2 class="editor-heading">A heading</h2> <p class="editor-paragraph"> A paragraph with <a class="editor-link" href="#content">a link</a>, <em>emphasis</em> and <code class="code">inline code</code>. </p> <h3 class="editor-subheading">A subheading</h3> <ul class="editor-list"> <li class="editor-item"> <p class="editor-paragraph">A list with bullets</p> </li> <li class="editor-item"> <p class="editor-paragraph">Its markers in the muted ink</p> </li> </ul> <ol class="editor-list editor-list-numbered"> <li class="editor-item"> <p class="editor-paragraph">A list with numbers</p> </li> <li class="editor-item"> <p class="editor-paragraph">On an ordered list</p> </li> </ol> <blockquote class="editor-quote"> <p class="editor-paragraph">A quotation, a step quieter.</p> </blockquote> <hr class="editor-rule"> <p class="editor-paragraph">And a paragraph after a rule.</p> </div> </div></template>#상태
각 상태는 엔진이 요소에 유지하는 속성이거나 페이지가 틀에 설정하는 속성입니다. 포커스와 aria-invalid="true"는 틀을 강조하거나 위험 상태의 가장자리를 표시합니다. aria-readonly="true"는 캐럿 없이 틀을 평평하게 만들고, 틀에 aria-disabled="true"를 지정하면 비활성화 잉크 색의 평평한 오목한 영역이 됩니다. 문서가 유효하지 않으면 필드의 field-error를 표시합니다. 에디터를 비활성화할 때는 도구 모음의 컨트롤도 함께 비활성화하고, 엔진에 편집할 수 없는 상태임을 알리세요.
상태
<div class="grid gap-lg w-full max-w(560) mx-auto"> <div class="field"> <span id="state-invalid">Summary</span> <div class="editor" style="--editor-rows: 2"> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-invalid" aria-describedby="state-invalid-error" aria-invalid="true" contenteditable="true"></div> </div> <p class="field-error" id="state-invalid-error"> Write at least a sentence before you publish. </p> </div> <div class="field"> <span id="state-readonly">Published notes</span> <div class="editor" style="--editor-rows: 2"> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-readonly" aria-readonly="true" contenteditable="false" tabindex="0"> <p class="editor-paragraph"> Version 0.3 shipped tags, editable values and sortable lists. </p> </div> </div> </div> <div class="field"> <span id="state-disabled">Draft</span> <div class="editor" style="--editor-rows: 2" aria-disabled="true"> <div class="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="false" disabled> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M4.6667 3H8.3333C12.3333 3 12.3333 7.6667 8.3333 7.6667H4.6667M4.6667 3V13H9C13.3333 13 13.3333 7.6667 9 7.6667" /> </svg> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false" disabled> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6.6667 3L12.6667 3" /><path d="M3.3333 13L9.3333 13" /><path d="M9.6667 3L6.3333 13" stroke-linecap="butt" /> </svg> </button> <span class="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false" disabled> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="3" cy="4" r="0.5" fill="currentColor" stroke="none" /><path d="M6 4L13.5 4" /><circle cx="3" cy="8" r="0.5" fill="currentColor" stroke="none" /><path d="M6 8L13.5 8" /><circle cx="3" cy="12" r="0.5" fill="currentColor" stroke="none" /><path d="M6 12L13.5 12" /> </svg> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false" disabled> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M9 4.3333L10 3.3333C11.0125 2.3208 12.6541 2.3208 13.6667 3.3333C14.6792 4.3459 14.6792 5.9875 13.6667 7L11.6667 9C10.6541 10.0125 9.0125 10.0125 8 9" /><path d="M9 4.3333L10 3.3333C11.0125 2.3208 12.6541 2.3208 13.6667 3.3333C14.6792 4.3459 14.6792 5.9875 13.6667 7L11.6667 9C10.6541 10.0125 9.0125 10.0125 8 9" transform="rotate(180 8 8)" /> </svg> </button> </div> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-disabled" aria-disabled="true" contenteditable="false"> <p class="editor-paragraph">Locked while the release is reviewed.</p> </div> </div> </div></div>import BoldIcon from '@master/icons-react/native/16/soft/bold'import ItalicIcon from '@master/icons-react/native/16/soft/italic'import ListIcon from '@master/icons-react/native/16/soft/list'import LinkIcon from '@master/icons-react/native/16/soft/link'<div className="grid gap-lg w-full max-w(560) mx-auto"> <div className="field"> <span id="state-invalid">Summary</span> <div className="editor" style={{ '--editor-rows': '2' } as React.CSSProperties}> <div className="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-invalid" aria-describedby="state-invalid-error" aria-invalid="true" contentEditable="true"></div> </div> <p className="field-error" id="state-invalid-error"> Write at least a sentence before you publish. </p> </div> <div className="field"> <span id="state-readonly">Published notes</span> <div className="editor" style={{ '--editor-rows': '2' } as React.CSSProperties}> <div className="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-readonly" aria-readonly="true" contentEditable="false" tabIndex={0}> <p className="editor-paragraph"> Version 0.3 shipped tags, editable values and sortable lists. </p> </div> </div> </div> <div className="field"> <span id="state-disabled">Draft</span> <div className="editor" style={{ '--editor-rows': '2' } as React.CSSProperties} aria-disabled="true"> <div className="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="false" disabled> <BoldIcon className="icon" /> </button> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false" disabled> <ItalicIcon className="icon" /> </button> <span className="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false" disabled> <ListIcon className="icon" /> </button> <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false" disabled> <LinkIcon className="icon" /> </button> </div> <div className="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-disabled" aria-disabled="true" contentEditable="false"> <p className="editor-paragraph">Locked while the release is reviewed.</p> </div> </div> </div></div><script> import BoldIcon from '@master/icons-svelte/native/16/soft/bold' import ItalicIcon from '@master/icons-svelte/native/16/soft/italic' import ListIcon from '@master/icons-svelte/native/16/soft/list' import LinkIcon from '@master/icons-svelte/native/16/soft/link'</script><div class="grid gap-lg w-full max-w(560) mx-auto"> <div class="field"> <span id="state-invalid">Summary</span> <div class="editor" style="--editor-rows: 2"> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-invalid" aria-describedby="state-invalid-error" aria-invalid="true" contenteditable="true"></div> </div> <p class="field-error" id="state-invalid-error"> Write at least a sentence before you publish. </p> </div> <div class="field"> <span id="state-readonly">Published notes</span> <div class="editor" style="--editor-rows: 2"> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-readonly" aria-readonly="true" contenteditable="false" tabindex="0"> <p class="editor-paragraph"> Version 0.3 shipped tags, editable values and sortable lists. </p> </div> </div> </div> <div class="field"> <span id="state-disabled">Draft</span> <div class="editor" style="--editor-rows: 2" aria-disabled="true"> <div class="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="false" disabled> <BoldIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false" disabled> <ItalicIcon class="icon" /> </button> <span class="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false" disabled> <ListIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false" disabled> <LinkIcon class="icon" /> </button> </div> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-disabled" aria-disabled="true" contenteditable="false"> <p class="editor-paragraph">Locked while the release is reviewed.</p> </div> </div> </div></div><script setup>import BoldIcon from '@master/icons-vue/native/16/soft/bold'import ItalicIcon from '@master/icons-vue/native/16/soft/italic'import ListIcon from '@master/icons-vue/native/16/soft/list'import LinkIcon from '@master/icons-vue/native/16/soft/link'</script><template> <div class="grid gap-lg w-full max-w(560) mx-auto"> <div class="field"> <span id="state-invalid">Summary</span> <div class="editor" style="--editor-rows: 2"> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-invalid" aria-describedby="state-invalid-error" aria-invalid="true" contenteditable="true"></div> </div> <p class="field-error" id="state-invalid-error"> Write at least a sentence before you publish. </p> </div> <div class="field"> <span id="state-readonly">Published notes</span> <div class="editor" style="--editor-rows: 2"> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-readonly" aria-readonly="true" contenteditable="false" tabindex="0"> <p class="editor-paragraph"> Version 0.3 shipped tags, editable values and sortable lists. </p> </div> </div> </div> <div class="field"> <span id="state-disabled">Draft</span> <div class="editor" style="--editor-rows: 2" aria-disabled="true"> <div class="toolbar editor-toolbar" role="toolbar" aria-label="Formatting"> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bold" aria-pressed="false" disabled> <BoldIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Italic" aria-pressed="false" disabled> <ItalicIcon class="icon" /> </button> <span class="toolbar-separator" role="separator" aria-orientation="vertical"></span> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Bulleted list" aria-pressed="false" disabled> <ListIcon class="icon" /> </button> <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Link" aria-pressed="false" disabled> <LinkIcon class="icon" /> </button> </div> <div class="editor-document" role="textbox" aria-multiline="true" aria-labelledby="state-disabled" aria-disabled="true" contenteditable="false"> <p class="editor-paragraph">Locked while the release is reviewed.</p> </div> </div> </div> </div></template>#접근성
- 문서는
aria-multiline="true"를 지정한role="textbox"입니다.aria-labelledby로 필드의 레이블을 이름으로 지정하고,aria-describedby로 도움말과 오류 메시지를 설명으로 연결합니다.<label for>는 폼 컨트롤이 아닌 요소의 이름을 지정할 수 없습니다. - 도구 모음은 Tab 키 이동 순서에서 한 지점이며, 이름을 지정하고
aria-controls로 문서를 가리킵니다. 모든 아이콘 버튼에 이름을 지정하고, 토글 버튼은aria-pressed로 표시하며, 엔진이 처리하는 단축키를aria-keyshortcuts에 지정하세요. - 도구 모음에서 명령을 실행한 뒤에는 독자가 작성하던 문서로 포커스를 되돌립니다.
- 문서에 별도의 키 처리기를 추가하지 마세요. 입력기는 단어를 조합할 때 Enter 키와 방향키를 사용하며, 엔진은 그 시점을 알고 있습니다.
- 강제 색상 모드에서는 틀에 필드 색상의 윤곽선이 표시되고, 포커스가 있는 동안에는 강조 색상의 윤곽선이 표시됩니다.
#클래스
| 클래스 | 설명 |
|---|---|
editor | 도구 모음 띠와 문서를 담는 오목한 필드 틀입니다. 문서에 포커스가 들어오면 틀이 올라옵니다. |
editor-toolbar | 틀 위쪽의 도구 모음에 지정합니다. 안쪽 여백 하나만큼 들어가 평평하게 놓이고 아래에 가는 구분선이 생기며, 에디터가 좁으면 줄바꿈됩니다. |
editor-document | 엔진이 편집 가능하게 만드는 요소입니다. --editor-rows줄에서 --editor-max-rows줄까지 늘어난 뒤 스크롤됩니다. aria-labelledby로 이름을 지정하고, 필드의 도움말로 설명을 연결하세요. |
editor-paragraph | 문서의 문단 |
editor-heading | 문서의 제목으로, h2 또는 엔진이 작성하는 수준의 요소에 지정합니다 |
editor-subheading | editor-heading보다 한 수준 아래의 제목 |
editor-list | 글머리 기호 목록으로, 기호는 흐린 잉크 색입니다. 항목 안의 목록에는 원형 기호가 사용됩니다. |
editor-list-numbered | ol 요소에 지정하며, 글머리 기호 대신 번호를 표시합니다적용할 클래스는 editor-list입니다 |
editor-item | 목록의 항목 |
editor-quote | blockquote 요소에 지정하는 인용문입니다. 시작 부분에 선이 있고 텍스트가 한 단계 차분하게 표시됩니다. |
editor-link | 문서 안의 링크로, 해당 줄의 잉크 색으로 밑줄이 표시됩니다 |
editor-rule | 문서의 부분 사이에 놓이는 가로 구분선 |
#사용자 지정 속성
| 속성 | 기본값 | 설명 |
|---|---|---|
--editor-rows | 6 | 문서가 비어 있을 때 표시하는 줄 수 |
--editor-max-rows | 18 | 스크롤되기 전까지 늘어나는 줄 수 |
#관련 항목
- 입력 필드표면을 파낸 듯한 텍스트 입력 필드와 레이블, 힌트, 오류, 입력 그룹.
- 도구 모음눈에 띄지 않는 컨트롤을 한 줄로 담는 작고 살짝 솟은 표면입니다.
- 메시지 입력창메시지나 프롬프트를 작성하는 입력창입니다. 텍스트에 따라 입력란이 늘어나며 그 아래에 도구가 한 줄로 배치됩니다.
- 코드텍스트를 입력된 그대로 고정폭 글꼴로 표시합니다. 인라인이나 블록으로 사용할 수 있습니다.