@@ -15,10 +15,7 @@ class Placeholder extends WidgetType {
1515 typeof this . content == "string" ? document . createTextNode ( this . content ) :
1616 typeof this . content == "function" ? this . content ( view ) :
1717 this . content . cloneNode ( true ) )
18- if ( typeof this . content == "string" )
19- wrap . setAttribute ( "aria-label" , "placeholder " + this . content )
20- else
21- wrap . setAttribute ( "aria-hidden" , "true" )
18+ wrap . setAttribute ( "aria-hidden" , "true" )
2219 return wrap
2320 }
2421
@@ -39,7 +36,7 @@ class Placeholder extends WidgetType {
3936/// Extension that enables a placeholder—a piece of example content
4037/// to show when the editor is empty.
4138export function placeholder ( content : string | HTMLElement | ( ( view : EditorView ) => HTMLElement ) ) : Extension {
42- return ViewPlugin . fromClass ( class {
39+ let plugin = ViewPlugin . fromClass ( class {
4340 placeholder : DecorationSet
4441
4542 constructor ( readonly view : EditorView ) {
@@ -52,4 +49,7 @@ export function placeholder(content: string | HTMLElement | ((view: EditorView)
5249
5350 get decorations ( ) { return this . view . state . doc . length ? Decoration . none : this . placeholder }
5451 } , { decorations : v => v . decorations } )
52+ return typeof content == "string" ? [
53+ plugin , EditorView . contentAttributes . of ( { "aria-placeholder" : content } )
54+ ] : plugin
5555}
0 commit comments