-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text.Style.fontAxes issue #810
Comments
PSThe screenshot of evaluate Object.keys() on null, happens on I use following codes to bypass: // prepare to copy from style source
let styleStr = JSON.stringify(layer.style);
let styleBase = JSON.parse(styleStr);
if (styleBase.fontAxes) {
// fontAxes issue: https://github.com/sketch-hq/SketchAPI/issues/810
styleBase.fontAxes = Object.assign({}, <FontAxes>{
id: styleBase.fontAxes.id,
min: styleBase.fontAxes.min,
max: styleBase.fontAxes.max,
value: styleBase.fontAxes.value
})
} else {
// bypass Sketch API evaluating Object.keys() on null fontAxes
delete styleBase.fontAxes;
}
styleStr = JSON.stringify(styleBase);
// ...
newLayer.style = JSON.parse(styleStr) |
This file shows more issue about run: let layer = context.document.pages[0].layers[0].layers[0] as Text;
console.log(layer.style.fontAxes); output:
If I assign this style to another layer, Sketch crashes. |
This was referenced Nov 4, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
error.zip
Above is a file reported by one my user, many of them encountered issues in this part.
How to reproduce
then, try:
Output:
Issues
layer.style
to another layer, Sketch crashes instantlyText.Style.fontAxes
doesn't have propertyWeight
according to documentationWeight.value
is object (Obj-C?). SoJSON.stringify
doesn't work with itNo matter what has happened, I think the API should do the compatible magic to these circumstances.
The text was updated successfully, but these errors were encountered: