Global

Methods


Listeners()

DrPublish provides a large set of default events that an app can listen for. All events that start their name with 'before' can be stopped by an app. This is done by returning 'false' from the callback function, as in the 'beforSave' example given bellow.

Other apps can also supply their own events using the PluginAPI.emit(...) function. Documention on these events are up to each app to create.

Available Events

addCategory

triggered after a category has been added to the article

addTag

triggered after a tag had been added to the article

appPaneMaximized

triggered when the app pane is maximized

appPaneRestored

triggered when the app pane is restored to its' original size

appAuthenticated

triggered when an app has been authenticated

changedCustomMeta

triggered when a custom meta property is changed/set, parameter is an object with property name and value

receivedFocus

triggered when a plugin receives focus. Receives a parameter object that has two predefined values: previousPluginName - name of previous plugin, givenFocus - true when focus was sent from another plugin. The parameter object can also contain other keys supplied by the plugin losing focus.

afterCreate

triggered after a new article has been created

beforeDelete

triggered before an article is deleted

afterDelete

triggered after an article has been deleted

afterLoad

triggered after an article has been loaded

afterPublish

triggered after an article has been published

afterSave

triggered after an article has been saved

beforeCreate

triggered before a new article is created

beforeLoad

triggered before an article is loaded into the editor

beforePreview

triggered before the article is opened in the preview

beforeSave

triggered before an article is saved

beforePublish

triggered before an article is published

editorFocus

triggered when an editor gets focus

editorUnfocus

triggered when an editor loses focus

editorsLostFocus

triggered when all editors loses focus

editorReady

triggered when the editor has been fully loaded and is ready for input

modifiedContent

triggered whenever content changes in the article

elementRemoved

triggered when a plugin element from the current plugin is removed, receives an object with element id as a parameter

pluginElementClicked

triggered when someone clicks on a plugin element in the editor

pluginElementSelected

triggers when someone selects a plugin element in the editor

pluginElementDeselected

triggered when someone deselects a plugin element in the editor

Example
PluginAPI.on('afterCreate', function() {
    PluginAPI.Article.setSource('Ny Times');
});
PluginAPI.on('beforeSave', function() {
    if (!articleIsAwesome()) {
         return false;
    }
});