Class MarkdownMonsterAddin

Addin Base class that exposes core functionality to the addin.

System.Object
  MarkdownMonster.AddIns.MarkdownMonsterAddin
public abstract class MarkdownMonsterAddin : object

Class Members

MemberDescription

AddMenuItem

Allows insertion of a menu item relative to another menu item by name or menu text

public bool AddMenuItem(MenuItem mitem,     string menuItemNameToFind,     string menuItemTextToFind,     AddMenuItemModes addMode)

CloseTab

Closes a specific tab that you pass. You can look at the tab collection via Model.Window.TabControl.

public Task CloseTab(TabItem tab)

public Task CloseTab(string filename)

ExecuteEditCommand

Executes a predefined edit command (bold,italic,href etc.) against the editor.

public Task ExecuteEditCommand(string action)

GetMarkdown

Returns the active live markdown text from the editor

public Task GetMarkdown()

GetMarkdownDocument

Returns the Markdown document object instance which has access to the actual document that ends up being saved. This includes the content and the IsDirty flag. Note that content is updated only after save operations. If you need to update live content it's best to inject directly into the edtor using the GetSelectedText() and SetSelectedText().

public MarkdownDocument GetMarkdownDocument()

GetMarkdownEditor

Retrieve an instance of the MarkdownEditor control from the active window. This instance wraps the editor and provides a number of methods for getting access to the editor document

public MarkdownDocumentEditor GetMarkdownEditor()

GetMarkdownParser

If this addin wants to provide a custom Markdown Parser this method can be overriden to do it.

public virtual IMarkdownParser GetMarkdownParser(bool usePragmaLines,     bool force)

GetPreviewBrowserUserControl

Allows returning a WPF control that implements IPreviewBrowser and that handles previewing the output from documents.

This control should return an IPreviewBrowser interface implemented on a WPF UIControl (UserControl most likely).

public virtual IPreviewBrowser GetPreviewBrowserUserControl()

GetSelection

Gets the active selection from the editor

public Task GetSelection()

OnAfterOpenDocument

Called after a new document has been opened. If this is a new document the filename will be 'untitled'

public virtual Task OnAfterOpenDocument(MarkdownDocument doc)

OnAfterSaveDocument

Called after the document has been saved.

public virtual Task OnAfterSaveDocument(MarkdownDocument doc)

OnApplicationInitialized

Fired when the application has Initialized, the Window is available and the model has been loaded. This happens after OnApplicationStart() but before OnWindowLoaded() and allows you to access the Model and Window before initial data binding of the Window occurs.

Most basic configuration options should be performed in this method

public virtual Task OnApplicationInitialized(AppModel model)

OnApplicationShutdown

Called just before the application is shut down

public virtual Task OnApplicationShutdown()

OnApplicationStart

Called when the application starts and after the AddinManager has initialized.

Use this handler to add new menu items to the Addin Toolbar.

public virtual Task OnApplicationStart()

OnBeforeOpenDocument

Called before a document is opened. Return false to keep the document from being opened

public virtual Task OnBeforeOpenDocument(string filename)

OnBeforeSaveDocument

Called before the document is saved. Return false to disallow saving the document

public virtual Task OnBeforeSaveDocument(MarkdownDocument doc)

OnCanExecute

Called to determine whether the menu option should be enabled and execute

public virtual bool OnCanExecute(object sender)

OnDocumentActivated

Called whenever a new document is activated in the editor (when tabs change). Note on startup if multiple documents are open this method is called for each document.

public virtual Task OnDocumentActivated(MarkdownDocument doc)

OnDocumentUpdated

Called whenever the document is updated and the document's current text is updated. Note this may not be always 100% in sync of what's in the editor as the document is updated only when the user stops typing for around a second.

public virtual Task OnDocumentUpdated()

OnEditorCommand

Optional editor command handler that can intercept editor commands like bold/italic that are fired if not handled previously by the default handlers.

Allows adding custom handlers for additional markdown expansions you'd like to fire from custom buttons, or using AdditionalToolbarIcons.

public virtual Task OnEditorCommand(string command,     string input)

OnExecute

Called when the Menu or Toolbar button is clicked

public virtual Task OnExecute(object sender)

OnExecuteConfiguration

Called when the configuration Toolbar drop down button is clicked

public virtual Task OnExecuteConfiguration(object sender)

OnInstall

Called after the addin is initially installed. Use this method to install additional resources or add additional one time configuration.

public virtual void OnInstall()

OnModelLoaded

Fired when the application has Initialized the Model. This happens after OnApplicationStart() but before OnWindowLoaded() and allows you to access the Model before initial data binding of the Window occurs.

public virtual Task OnModelLoaded(AppModel model)

OnModifyPreviewHtml

Allows addins to intercept the html used for the preview, to examine or further manipulate it, e.g. insert a style block in the head.

public virtual Task OnModifyPreviewHtml(string renderedHtml,     string markdownHtml)

OnNotifyAddin

An optional command string that is fired into addins

You can override this method to capture commands that are not already handled by the editor.

public virtual Task OnNotifyAddin(string command,     object parameter)

OnPreviewLinkNavigation

Allows you to detect Preview Browser Link navigation and take over the navigation.

public virtual Task OnPreviewLinkNavigation(string url,     string src)

OnSaveImage

Called when an image is to be saved. By default MM saves images to disk. You can hook this method with your add in to take over the image save operation. Return true to indicate you handled the

public virtual Task OnSaveImage(object image)

OnUninstall

Called after the addin has been uninstalled. Allows for additional cleanup.

public virtual void OnUninstall()

OnWindowLoaded

public virtual Task OnWindowLoaded()

OpenTab

Opens a tab with a given filename and selects it

public Task OpenTab(string filename)

RefreshPreview

Refreshes the Html Preview Window if active.

Happens in background.

public void RefreshPreview(bool keepScrollPosition)

SetEditorFocus

Brings the editor to focus

public Task SetEditorFocus()

SetMarkdown

Sets all the text in the markdown editor

public Task SetMarkdown(string markdownText)

SetSelection

Sets the active selection from the editor.

public Task SetSelection(string text)

ShowStatus

Displays a status message on the main application's status bar

public void ShowStatus(string message,     int timeoutMs,     FontAwesomeIcon icon,     Color color,     bool spin)

ShowStatusError

Displays and error message on the status bar using common default values (red icon, standard timeout, warning icon)

public void ShowStatusError(string message,     int timeout,     FontAwesomeIcon icon,     Color color)

ActiveDocument

Returns the active Markdown document that's being edited. The document holds the actual markdown text and knows how to load, save and render the markdown contained within it.

ActiveEditor

Returns an instance of the Active Editor instance. The editor contains editor behavior of the browser control as well as all interactions with the editor's event model and text selection interfaces.

Contains an AceEditor property that references the underlying JavaScript editor wrapper instance.

Id

Optional Id for this addin - use a recognizable Id

IsEnabled

Determines whether this addin is enabled

MenuItems

List of menu items that are used to extend MM Menu items get attached to the Addin menu and fire when clicked.

Model

The application model which gives you access to Markdown Monster. Includes access to Configuration and the Main Window

Name

The display name of the Addin

Requirements

Namespace: MarkdownMonster.AddIns
Assembly: markdownmonster.exe

© West Wind Technologies, 2016-2024 • Updated: 11/23/21
Comment or report problem with topic