Editors

DSHDLib. Namespace

Editors

Source:

Classes

Editor

Namespaces

ProjectData

Methods

(static) insert(parent_elementnon-null, confignon-null, callbacknon-null) → {DSHDLib.Editors.Editor}

Description:
  • Create and insert a new editor iframe into the DOM
Source:
Examples
DSHDLib.Editors.insert("abc", { project_id: "abc" }, function(err, e){
    var editor = e;
});
DSHDLib.Editors.insert("abc", { project_id: "abc", gallery_id: "def", access_token: "ghi" }, function(err, e){
    var editor = e;
});
Parameters:
Name Type Description
parent_element string | HtmlElement An id or direct reference for an existing html DOM element to insert the iframe into
config DSHDLib.Editors.EditorConfig Context and settings for the new editor instance
callback DSHDLib.Editors.newEditorCallback A function to receive the new editor instance
Returns:
- If an access token is supplied explicitly, this will return the newly created editor instance immediately
Type
DSHDLib.Editors.Editor

Type Definitions

EditorConfig

Description:
  • Context and settings for an editor instance - See DSHDLib.LibraryConfig for additional library configuration override properties that can be used
Source:
Properties:
Name Type Attributes Default Description
project_id string The project to load into the editor
page_number number <optional>
1 The page to open in the project upon editor load
internal bool <optional>
false In special domain/cookie scenarios, allows the editor to open without an access token stored in the library
gallery_id string <optional>
A context-specific filter value for custom media galleries in the editor
expand_right_panel bool <optional>
false Display the right panel upon editor load even in scenarios where it would be collapsed by default
hide_right_panel bool <optional>
false Completely hide the right panel and all of its functionality. Commonly used to create custom paging controls alongside the editor
hide_undo_redo bool <optional>
false Hide the undo/redo controls that show above the canvas
hide_zoom bool <optional>
false Hide the zoom control that shows above the canvas
hide_prev_next bool <optional>
false Hide the previous/next page/scene controls that show below the canvas on multi-page/scene projects
hide_play_scene bool <optional>
false Hide the Play Scene control that shows below the canvas on video projects
hide_play_all bool <optional>
false Hide the Play All control that shows below the canvas on multi-scene video projects
zoom number | string <optional>
"fit" The initial zoom level applied upon editor load. Allows a number between 0.1 and 3 or "fit" or "fill"
theme_color1 string <optional>
Override the default environment theme "dark" color. Supply in hex format with no preceding #
theme_color2 string <optional>
Override the default environment theme "light" color. Supply in hex format with no preceding #
locale string <optional>
Override the default user-based locale setting to show the editor in a different language
color_defaults_rgb Array.<string> <optional>
Override the default RGB color palette
color_defaults_cmyk Array.<string> <optional>
Override the default CMYK color palette
product_image_url string <optional>
The URL to an externally hosted image to load as the product image background (Doc)
product_image_width number <optional>
Set the width of the product image background relative to the canvas zone (Doc)
product_image_height number <optional>
Set the height of the product image background relative to the canvas zone (Doc)
product_image_canvas_zone_dimensions string <optional>
Set the canvas zone dimensions relative to the product image background (Doc)
product_image_canvas_zone_offset string <optional>
Set the canvas zone position relative to the product image background (Doc)
product_image_canvas_zone_horizontal_align string <optional>
If the canvas zone aspect ratio does not match the project aspect ratio, set hoizontal alignment of the canvas within the canvas zone (Doc)
product_image_canvas_zone_vertical_align string <optional>
If the canvas zone aspect ratio does not match the project aspect ratio, set vertical alignment of the canvas within the canvas zone (Doc)
product_image_canvas_mobile_zoom_offset number <optional>
If the editor loads on mobile, decrease the visible canvas size to display more of the product image background around it
temporary_background_image_url string <optional>
Set a temporary background image on load. See changeTemporaryBackground for more info
temporary_background_color string <optional>
Set a temporary background color on load. Supply in hex format with no preceding #. See changeTemporaryBackground for more info
classes_context string <optional>
"global" For admins, override the Classes list source context. One of: "system_templates", "account"
classes_list Array.<string> <optional>
For admins, override the Classes list with static values. classes_context is ignored when this is set
disable_class_creation bool <optional>
false Disable the admin from being able to create new Classes
class_modification_element_types Array.<string> <optional>
Disable the admin from being able to set Classes on element types not present in the supplied list. Use an empty array to disable Class selection completely. Otherwise, one or more of: "text", "image", "vector", "video", "lottie", "zone", "background"
Context and settings for an editor instance - See DSHDLib.LibraryConfig for additional library configuration override properties that can be used
Type:

newEditorCallback(erroropt, editor)

Description:
  • Callback supplying a new editor instance
Source:
Parameters:
Name Type Attributes Description
error Error <optional>
An error if implicit guest token retrieval fails
editor DSHDLib.Editors.Editor A newly created editor instance