File tree Expand file tree Collapse file tree
packages/super-editor/src
extensions/fillable-field Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ export function exportSchemaToJson(params) {
8181 tableRow : translateTableRow ,
8282 tableCell : translateTableCell ,
8383 bookmarkStart : translateBookmarkStart ,
84+ fillableField : translateFillableField ,
8485 fieldAnnotation : translateFieldAnnotation ,
8586 tab : translateTab ,
8687 image : translateImageNode ,
@@ -1812,6 +1813,19 @@ function translateFieldAnnotation(params) {
18121813 } ;
18131814} ;
18141815
1816+ function translateFillableField ( params ) {
1817+ const { node, isFinalDoc } = params ;
1818+ const { attrs = { } } = node ;
1819+ const { displayLabel } = attrs ;
1820+ console . log ( params ) ;
1821+
1822+ return {
1823+ name : 'w:t' ,
1824+
1825+ elements : [ { text :displayLabel , type : 'text' } ] ,
1826+ } ;
1827+ } ;
1828+
18151829export function translateHardBreak ( params ) {
18161830 const { node = { } } = params ;
18171831 const { attrs = { } } = node ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ export const FillableField = Node.create({
1212 selectable : true ,
1313 addAttributes ( ) {
1414 return {
15-
1615 displayLabel : {
1716 default : 'Text field' ,
1817 parseDOM : ( elem ) => elem . getAttribute ( 'data-display-label' ) ,
@@ -33,6 +32,16 @@ export const FillableField = Node.create({
3332 } ;
3433 } ,
3534 } ,
35+ isFillable : {
36+ default : true ,
37+ parseDOM : ( elem ) => elem . getAttribute ( 'data-fillable-field' ) ,
38+ renderDOM : ( attrs ) => {
39+ if ( ! attrs . displayLabel ) return { } ;
40+ return {
41+ 'data-fillable-field' : true ,
42+ } ;
43+ } ,
44+ } ,
3645
3746 } ;
3847 } ,
You can’t perform that action at this time.
0 commit comments