Called by subclasses of
manager object must provide, at a minimum,
play methods. See
user.js in the
apostrophe-widgets module for examples. Normally you will extend
apostrophe-widgets and this will be invoked for you.
Fetch the manager object for the given widget type name.
Ensure that the
play method of the manager for every widget is invoked, if it exists, every time new widgets are present in the page. Adds a handler for the
enhance Apostrophe event, which is triggered both on page load and any time new content is rendered into the page during editing. The
play method will receive the widget's jQuery element, the widget's data and the configured options for that widget type.
Fetch the configured options for the specified
$widget, a jQuery element which should be markup representing a widget, with a
data-options JSON attribute.
Fetch the data associated with the specified
$widget, a jQuery element which should be markup representing a widget. The
data-apos-widget attribute is used to identify the widget type, and the
getData method of the manager for that widget type is invoked to get the data.
[data-apos-add-content] button is clicked, toggle the
apos-active class on the closest ancestor with
[data-apos-dropdown], and also the closest ancestor with
Handles the hovering of widgets in the specified selector or jQuery object and reveals only the controls on the directly hovered widget, not the parent wrapper widget
Enable the areas in the specified selector or jQuery object to be edited. If sel is falsy all areas currently in the body are made editable
Helper functions for getting widget data and options that don't depend on the context of a specific area editor Get the options that apply to the widget in its current context
Return an array of all area editor objects (subclasses of apostrophe-areas-editor) which are currently visible.
Gives all area editors a chance to save changes, if they need to, before invoking the callback.
Both the sync flag and the callback may be omitted entirely. The default is asynchronous. The sync flag is supported for bc only, we use a beforeUnload warning now.
This method is ideal in situations where you wish to be sure everything has been saved before transitioning to a UI such as a commit dialog box that displays what has changed, etc.
For bc only, we use an onBeforeUnload warning now as most browsers now refuse to do sync API calls in onBeforeUnload.
saveAllIfNeeded, this method is invoked on a
beforeunload event, when the user navigates away or closes the tab. However this method has no callback, makes only one synchronous API call to complete all of the work to maximize the chances of success when called during the
beforeunload event, and also unlocks any docs locked by the current html page as part of that one API call.