insertContainer Method

Callable

  • Inserts a channel container into the print area.

    example
    // Specify a container definition of a spot color.
    const containerDefinition = {
        name: "spot",
        type: "spotColor",
        previewColor: "rgba(0,255,0,255)"
    };
    const containerIndex = 4;
    
    // Load the editor.
    CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition)
        // If the editor has been successfully loaded.
        .then(function (editor) {
            // When we get the product.
            editor.getProduct().then(function (product) {
                // Insert a container.
                product.currentSurface.printAreas[0].insertContainer(containerDefinition, containerIndex);
            });
        });
    

    Parameters

    • containerDefiniton: IChannelContainerDefinition

      A container to add.

    • index: number | string

      A position of this container in the array of containers, either numeric or string value (a value greater than two). For example, "3".

    Returns Promise < Container >

    An instance of the inserted container.