@@ -10,6 +10,7 @@ import { PublishMetadataSource } from 'packages/publish/src/PublishMetadataSourc
1010import { EMBED_MAX_DEPTH , RenderChildType } from 'packages/core/src/config/FieldConfigs' ;
1111import { DateParser } from 'packages/core/src/parsers/DateParser' ;
1212import { setFirstWeekday } from 'packages/core/src/utils/DatePickerUtils' ;
13+ import { PublishNotePosition } from 'packages/publish/src/PublishNotePosition' ;
1314
1415export class MetaBindPublishPlugin implements IPlugin {
1516 settings : MetaBindPluginSettings ;
@@ -83,23 +84,13 @@ export class MetaBindPublishPlugin implements IPlugin {
8384 return ;
8485 }
8586
86- const sectionInfo = ctx . getSectionInfo ( el ) ;
87- let position = undefined ;
88-
89- if ( sectionInfo ) {
90- position = {
91- lineStart : sectionInfo . lineStart ,
92- lineEnd : sectionInfo . lineEnd ,
93- } ;
94- }
95-
9687 const mountable = this . api . createInlineFieldOfTypeFromString (
9788 fieldType ,
9889 content ,
9990 filePath ,
10091 undefined ,
10192 RenderChildType . BLOCK ,
102- position ,
93+ new PublishNotePosition ( ctx , el ) ,
10394 ) ;
10495 const mdrc = this . api . wrapInMDRC ( mountable , codeBlock , ctx ) ;
10596
@@ -144,20 +135,10 @@ export class MetaBindPublishPlugin implements IPlugin {
144135
145136 // "meta-bind-button" code blocks
146137 publish . registerMarkdownCodeBlockProcessor ( 'meta-bind-button' , ( source , el , ctx ) => {
147- const sectionInfo = ctx . getSectionInfo ( el ) ;
148- let position = undefined ;
149-
150- if ( sectionInfo ) {
151- position = {
152- lineStart : sectionInfo . lineStart ,
153- lineEnd : sectionInfo . lineEnd ,
154- } ;
155- }
156-
157138 const mountable = this . api . createButtonMountable ( ctx . sourcePath , {
158139 declaration : source ,
159140 isPreview : false ,
160- position : position ,
141+ position : new PublishNotePosition ( ctx , el ) ,
161142 } ) ;
162143
163144 const mdrc = this . api . wrapInMDRC ( mountable , el , ctx ) ;
0 commit comments