@@ -2,6 +2,7 @@ import { block, toggle } from "../../domUtils";
22import { addChange } from "../changes" ;
33import { Toast } from "../../toast" ;
44import { updateGrid } from "../index" ;
5+ import { getKeywordView } from "./keyword" ;
56
67/**
78 * Returns if the method code has routines.
@@ -20,12 +21,13 @@ function switchToRoutineCode (code) {
2021 return code . replace ( / ^ / , "\t" ) . replace ( / \n / g, "\n\t" ) ;
2122}
2223
23- export function getCodeCaptionView ( { name, data, savePath } ) {
24+ export function getCodeCaptionView ( { manifest , name, data, savePath } ) {
2425
2526 let div = block ( `div` , `property-block` ) ,
2627 header = block ( `div` ) ,
2728 editBlock = block ( `div` , `editor` ) ,
28- code = ( data [ name ] || "" ) . replace ( / \r ? \n $ / , "" ) ,
29+ code = ( data [ name ] || "" ) . replace ( / \r ? \n $ / , `` ) ,
30+ returnTypeProp = ( manifest [ name ] || { } ) [ "returnTypeProperty" ] || `` ,
2931 ROUTINE_SUPPORT = hasRoutineCode ( code ) ,
3032 useRoutinesToggle = toggle ( ROUTINE_SUPPORT ) ,
3133 useRoutinesBlock = block ( `div` , `property-block` ) ,
@@ -42,6 +44,13 @@ export function getCodeCaptionView ({ name, data, savePath }) {
4244 vb . appendChild ( useRoutinesToggle ) ;
4345 useRoutinesBlock . appendChild ( nb ) ;
4446 useRoutinesBlock . appendChild ( vb ) ;
47+ if ( returnTypeProp )
48+ header . appendChild ( getKeywordView ( {
49+ propManifest : manifest [ returnTypeProp ] ,
50+ propName : returnTypeProp ,
51+ propData : data [ "ReturnType" ] ,
52+ savePath : savePath . concat ( returnTypeProp )
53+ } ) ) ;
4554 header . appendChild ( useRoutinesBlock ) ;
4655
4756 useRoutinesToggle . checkbox . addEventListener ( "change" , ( ) => {
@@ -78,7 +87,9 @@ export function getCodeCaptionView ({ name, data, savePath }) {
7887 saveChanges ( ) ;
7988 } ) ;
8089
81- div . appendChild ( block ( `hr` ) ) ;
90+ let hr = block ( `hr` ) ;
91+ hr . setAttribute ( `title` , `Code Editor` ) ;
92+ div . appendChild ( hr ) ;
8293 div . appendChild ( header ) ;
8394 // setTimeout(() => new AutoGrid(header), 1);
8495 div . appendChild ( editBlock ) ;
0 commit comments