Plugin, which manages mocking contents. Contents may be pre-defined by ID in CKEditor configuration, or they may be defined on the fly via addContent.

getContent will either provide one of these registered contents or fallback to some default behavior, which will be a static content of reasonable state.

Example

ClassicEditor
.create( document.querySelector( '#editor' ), {
'coremedia:mock-content': {
defaults: {
initialDelayMs: 0,
changeDelayMs: 10000,
},
contents: [
{ id: 2, name: 'Static Name' },
{ id: 4, name: 'An Article', type: 'CMArticle' },
// Will toggle names back and forth.
{ id: 6, name: ['First Name', 'Second Name'] },
// Very Fast: Will toggle names back and forth.
{ id: 8, name: ['First Name', 'Second Name'], changeDelayMs: 1 },
// Represents a checked out document.
{ id: 10, editing: true },
// Represents a document, which is being worked on.
{ id: 12, editing: [true, false] },
// Represents an unreadable document.
{ id: 14, readable: false },
// Represents a document changing readable state.
{ id: 16, readable: [ false, true ] },
]
},
} )
.then( ... )
.catch( ... );

Hierarchy (view full)

Constructors

  • Parameters

    • editor: default

    Returns MockContentPlugin

    Inherit Doc

Properties

pluginName: string = PLUGIN_NAME

Methods

  • Validates, if a content of given ID or URI path is explicitly available. If not, this method will escalate with an Error.

    If this method fails, you should validate, if the default mock contents provided here have been modified, or if you forgot calling addContents before.

    Type Parameters

    • T extends string | number

    Parameters

    • idOrUriPath: T

      numeric ID or URI path to validate

    Returns T

    the provided ID or URI path to validate as is

    Throws

    Error if the content is not explicitly defined.