Information Classification: External Restricted.
See https://www.chili-publish.com/security
Working with Frame Settings
Once you have access to a frame, you can manipulate most of its settings through the properties you can find in the DOM documentation.
You can apply this based on your choice of logic:
- Registering to SelectedFrameChanged, and working on "document.selectedFrame"
- Looping through all frames based on a type (Editor Enumerations - FrameType)
- Finding frames in the document based on a tag
- ...
Frame Properties
All frames inherit the properties from the base frame object: Document Object Model - Frame
Individual frame types have their own classes (eg: Document Object Model - TextFrame)
Frame Constraints
Frame constraints can be configured on a variety of levels (document, page, layer, frame), and all are accessible through JavaScript.You can find the available constraint settings in ?Document Object Model - FrameConstraints
The following sample loops through all image frames in the document, and locks them for the end user:
function defaultLock() { var totalFrames = 0; ; var numPages = editor.GetObject("document.pages").length; for (var i = 0; i < numPages; i++) { var numFrames = editor.GetObject("document.pages[" + i + "].frames").length; totalFrames = totalFrames + numFrames; for (var j = 0; j < numFrames; j++) { var type = editor.GetObject("document.pages[" + i + "].frames[" + j + "].type"); if (type == "image") { editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockContent", "no"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockDelete", "yes_users"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockFrameSettings", "yes_users"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockMoveHorizontal", "yes_users"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockMoveVertical", "yes_users"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockResizeHorizontal", "yes_users"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockResizeVertical", "yes_users"); editor.SetProperty("document.pages[" + i + "].frames[" + j + "].frameConstraints", "lockRotate", "yes_users"); } } } }
Assigning Shapes to a Frame
A shape has to exist within the workspace, in order to use JS to assign a shape to a frame.
// Get the shape object from the workspace var shapePath = editor.GetObject('document.workSpace.defaultShapes[2]'); // Assign shape to the selected frame editor.ExecuteFunction("document.selectedFrame", "SetPaths", shapePath.paths); //unassign a shape to the frame editor.ExecuteFunction("document.selectedFrame","SetPaths",null);
Frame Index Setting
You can change the frame's index by using the following JS, The high index 5000 indicates to put the frame on top, the low index 0 indicates to put the frame at the bottom
editor.SetProperty('document.allFrames[0]','index','5000'); editor.SetProperty('document.selectedFrame','index','0');
All information on this page must be treated as External Restricted, or more strict. https://www.chili-publish.com/security