You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(!(typeoftemplateName=="string"||templateNameinstanceofString))throwTypeError(`Template for "${templateName}" must be a string.`);
89
+
if(!(typeoftemplate.highlight=="function"||template.highlightinstanceofFunction))throwTypeError(`Template for "${templateName}" invalid, because the highlight function provided is not a function; it is "${template.highlight}". Please make sure you use one of the constructors in codeInput.templates, and that you provide the correct arguments.`);
90
+
if(!(typeoftemplate.includeCodeInputInHighlightFunc=="boolean"||template.includeCodeInputInHighlightFuncinstanceofBoolean))throwTypeError(`Template for "${templateName}" invalid, because the includeCodeInputInHighlightFunc value provided is not a true or false; it is "${template.includeCodeInputInHighlightFunc}". Please make sure you use one of the constructors in codeInput.templates, and that you provide the correct arguments.`);
91
+
if(!(typeoftemplate.preElementStyled=="boolean"||template.preElementStyledinstanceofBoolean))throwTypeError(`Template for "${templateName}" invalid, because the preElementStyled value provided is not a true or false; it is "${template.preElementStyled}". Please make sure you use one of the constructors in codeInput.templates, and that you provide the correct arguments.`);
92
+
if(!(typeoftemplate.isCode=="boolean"||template.isCodeinstanceofBoolean))throwTypeError(`Template for "${templateName}" invalid, because the isCode value provided is not a true or false; it is "${template.isCode}". Please make sure you use one of the constructors in codeInput.templates, and that you provide the correct arguments.`);
93
+
if(!Array.isArray(template.plugins))throwTypeError(`Template for "${templateName}" invalid, because the plugin array provided is not an array; it is "${template.plugins}". Please make sure you use one of the constructors in codeInput.templates, and that you provide the correct arguments.`);
94
+
template.plugins.forEach((plugin,i)=>{
95
+
if(!(plugininstanceofcodeInput.Plugin)){
96
+
throwTypeError(`Template for "${templateName}" invalid, because the plugin provided at index ${i} is not valid; it is "${template.plugins[i]}". Please make sure you use one of the constructors in codeInput.templates, and that you provide the correct arguments.`);
97
+
}
98
+
});
99
+
88
100
codeInput.usedTemplates[templateName]=template;
89
101
// Add waiting code-input elements wanting this template from queue
0 commit comments