I want to clone our customize template to newly created workspaces like explained at Developing templates
The template consist of several elements, I decided to use gql-query-builder to support dynamic queries and make changing of templates with less troubles.
I programatically clone a template, after designing template in Bluescape workspace, I query all elements and hard code them in source code. then using gql-query-builder I convert hard coded template to queries and variables to create template elements in a single query
I had some issues, such as:
- When I fetch all elements, Bluescape returns float value for
TextBlock.content.span.fontSize
but only accepts integer for the same input - Same issue for
width
andheight
ofTextStyle
andTextStyleInput
The above-mentioned bugs was easily fixed by rounding numbers.
The following bug dosen’t allow me to exactly clone the template. This query and variable is generated by gql-query-builder by iterating over hard coded template elements (And filtering them to a single element to simplify reporting bug and reproducing it) and converting them to create inputs. The font size of input is 53
but the actual font size displayed in the workspace is too small something like 10
, when I click on the text, Bluescape shows 40
as fontSize
I have same issue with size of Icon
s as well
Query
mutation($workspaceId: String!, $input0: CreateTextInput!) {
createText0: createText(workspaceId: $workspaceId, input: $input0) {
id
}
}
Variable
{
"workspaceId": "2DwKTVxUnEyvU0A3IvCm",
"input0": {
"blocks": [
{
"block": {
"align": "left",
"content": [
{
"span": {
"fontFamily": "Source Sans Pro",
"fontWeight": "bold",
"color": {
"r": 255,
"g": 255,
"b": 255,
"a": 1
},
"content": [
{
"text": "Artwork"
}
]
}
}
]
}
}
],
"pinned": true,
"style": {
"fontSize": 53,
"fontFamily": "Noto Sans",
"verticalAlign": "top",
"color": {
"r": 32,
"g": 37,
"b": 42,
"a": 1
},
"backgroundColor": {
"r": 0,
"g": 0,
"b": 0,
"a": 0
},
"width": 197,
"height": 67
},
"surface": null,
"traits": null,
"transform": {
"origin": {
"anchor": "TopLeft"
},
"rotateZ": 0,
"x": 3743.070343866959,
"y": 9691.116578161646
},
"zIndex": 118
}
}