Pin a text/image to the last paragraph of the document

Is there a way to pin a text/image to the last paragraph of the document? Regardless of whether more than one page in the editor is opened, I want the text to always be in the last paragraph before the footer, so that it prevents the user from typing after the fixed text/image.

I did some tests on this, here’s the test:

      function () {
        var oDocument = Api.GetDocument();
        var oNewParagraph = Api.CreateParagraph();
        oNewParagraph.AddText("last paragraph.");

        var totalElements = oDocument.GetElementsCount();
        var lastElement = oDocument.GetElement(totalElements - 1);
        if (lastElement.GetClassType() == 'paragraph') {
          lastElement.InsertParagraph(oNewParagraph, "after", true);

Hello, we are currently analysing the issue, please wait.

Hello, no problem, I will wait.