File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,14 @@ div.ProseMirror {
282282 }
283283 }
284284
285+ li [dir = " rtl" ] {
286+ text-align : right ;
287+ }
288+
289+ li [dir = " ltr" ] {
290+ text-align : left ;
291+ }
292+
285293 ul , ol {
286294 padding-inline-start : 10px ;
287295 margin-inline-start : 10px ;
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ import Table from './../nodes/Table.js'
4141import TaskItem from './../nodes/TaskItem.js'
4242import TaskList from './../nodes/TaskList.js'
4343import Text from '@tiptap/extension-text'
44+ import TextDirection from './../extensions/TextDirection.ts'
4445import TrailingNode from './../nodes/TrailingNode.js'
4546/* eslint-enable import/no-named-as-default */
4647
@@ -113,6 +114,15 @@ export default Extension.create({
113114 } ) ,
114115 LinkBubble ,
115116 TrailingNode ,
117+ TextDirection . configure ( {
118+ types : [
119+ 'heading' ,
120+ 'paragraph' ,
121+ 'listItem' ,
122+ 'taskItem' ,
123+ 'blockquote' ,
124+ ] ,
125+ } ) ,
116126 ]
117127 const additionalExtensionNames = this . options . extensions . map ( e => e . name )
118128 return [
Original file line number Diff line number Diff line change @@ -16,16 +16,16 @@ const renderedHTML = (markdown) => {
1616describe ( 'TipTap' , ( ) => {
1717 it ( 'render softbreaks' , ( ) => {
1818 const markdown = 'This\nis\none\nparagraph'
19- expect ( renderedHTML ( markdown ) ) . toEqual ( `<p>${ markdown } </p>` )
19+ expect ( renderedHTML ( markdown ) ) . toEqual ( `<p dir="ltr" >${ markdown } </p>` )
2020 } )
2121
2222 it ( 'render hardbreak' , ( ) => {
2323 const markdown = 'Hard line break \nNext Paragraph'
24- expect ( renderedHTML ( markdown ) ) . toEqual ( '<p>Hard line break<br>Next Paragraph</p>' )
24+ expect ( renderedHTML ( markdown ) ) . toEqual ( '<p dir="ltr" >Hard line break<br>Next Paragraph</p>' )
2525 } )
2626
2727 it ( 'render taskList' , ( ) => {
2828 const markdown = '* [ ] item 1\n'
29- expect ( renderedHTML ( markdown ) ) . toEqual ( '<ul class="contains-task-list"><li data-checked="false" class="task-list-item checkbox-item"><input type="checkbox" class="" contenteditable="false"><label><p>item 1</p></label></li></ul>' )
29+ expect ( renderedHTML ( markdown ) ) . toEqual ( '<ul class="contains-task-list"><li dir="ltr" data-checked="false" class="task-list-item checkbox-item"><input type="checkbox" class="" contenteditable="false"><label><p dir="ltr" >item 1</p></label></li></ul>' )
3030 } )
3131} )
You can’t perform that action at this time.
0 commit comments