Enonic version: 7.8.4
When I have a contentType with a HtmlArea, shouldnt that result in a RichText type in GraphQL ?
In my case I have:
<input type="HTMLArea" name="content">
<label>Inhalt</label>
</input>
what ends up in
When I have a contentType with a HtmlArea, shouldnt that result in a RichText type in GraphQL ?
In my case I have:
<input type="HTMLArea" name="content">
<label>Inhalt</label>
</input>
what ends up in
Hi,
I believe you can use graphqlLib.reference("RichText")
as the type, and and libGuillotineMacro.processHtml()
in your resolver.
var libGraphql = require("/lib/graphql";);
var libGuillotineMacro = require("/lib/guillotine/macro");
...
{
params.fields.myField = {
type: libGraphql.reference("RichText"),
resolve: function (env) {
return libGuillotineMacro.processHtml({
value: env.source.myField,
type: env.args.processHtml.type,
imageWidths: env.args.processHtml.imageWidths,
imageSizes: env.args.processHtml.imageSizes,
});
}
};
}
Good luck!
– Tom Arild
Hi @tom ,
ok - I thought -.based on documentation here HTML Editor processing - Enonic Developer Portal - that this works out of the box!
@tsi If not, I would suggest to add the snippet of @tom to the docu !
Thx
I actually had to dig in the Guillotine codebase to figure this one out
AFAIK, htmlArea inputs should automatically get field type RichText, like you expect.
Which version of Guillotine are you using @luctho?
@asi - Any ideas what may be going on here?
In my case it wasn’t a schema created by Guillotine, but one of my own making.
include "com.enonic.lib:lib-guillotine:5.5.0"
@luctho Please, use HtmlArea
instead of HTMLArea
in your content type definition. Lib guillotine supports exactly the same name for input types as that defined in XP, for instance xp/InputTypeName.java at master · enonic/xp · GitHub
Also, you can find more details about HtmlArea
type input here All Input types - Enonic Developer Portal