iink SDK on Device

"addBlock failed: adding this block type is not supported"

Here, when we convert content, I want to erase the old block and add in a new one at the same coordinates. I'm just texting it right now, obviously, but I keep getting a "addBlock failed: adding this block type is not supported" and, when I include editor?.erase(originalBlock), a "can't delete root block" error. I'm wondering why this is occuring.


fun convertContent(content: ContentSelection? = null) {

        val conversionState = editor?.getSupportedTargetConversionStates(content)

        if (!conversionState.isNullOrEmpty()) {

            editor?.convert(content, conversionState.first())


            if(content != null) {

                var originalBlock = content as ContentBlock;

                var transform = editor?.renderer?.viewTransform;

                var topLeft = transform?.apply(originalBlock.box.x, originalBlock.box.y);

                var x = topLeft?.x;

                var y = topLeft?.y;


               // editor?.erase(originalBlock);


                editor?.waitForIdle();


                if (x != null && y != null) {

                    editor?.addBlock(x, y, "Text", MimeType.TEXT, "myscript")?.also(ContentBlock::close)

                }

            }

        }

    }


Okay, i changed it to a text document and it worked, except it keeps telling me i cant add a block at x and y

Okay, so now it works, but it won't show on the screen

Login or Signup to post a comment