mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 02:40:23 +02:00
* feat: Add unique ids for each block * fix: Improve code based on code review * feat(block ids): Use nanoid library for block id generation * Remove unused files * Add tests * Fix lint & test * fix: Remove unnecessary id generation, use nanoid(10) to shorten the id, add changelog and some documentation Also improved some documentation along the lines and fixed linting * Update copy-paste.spec.ts * fix id generation, add api method * Update blocks.spec.ts * update tests Co-authored-by: cobb <kebincheng@yeah.net> Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com> Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com> Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
// in cypress/support/index.d.ts
|
|
// load type definitions that come with Cypress module
|
|
/// <reference types="cypress" />
|
|
|
|
import type { EditorConfig, OutputData } from './../../../types/index';
|
|
import type EditorJS from '../../../types/index'
|
|
|
|
declare global {
|
|
namespace Cypress {
|
|
interface Chainable<Subject = any> {
|
|
/**
|
|
* Custom command to select DOM element by data-cy attribute.
|
|
* @param editorConfig - config to pass to the editor
|
|
* @example cy.createEditor({})
|
|
*/
|
|
createEditor(editorConfig: EditorConfig): Chainable<EditorJS>
|
|
|
|
/**
|
|
* Paste command to dispatch paste event
|
|
*
|
|
* @usage
|
|
* cy.get('div').paste({'text/plain': 'Text', 'text/html': '<b>Text</b>'})
|
|
*
|
|
* @param data - map with MIME type as a key and data as value
|
|
*/
|
|
paste(data: {[type: string]: string}): Chainable<Subject>
|
|
|
|
/**
|
|
* Copy command to dispatch copy event on subject
|
|
*
|
|
* @usage
|
|
* cy.get('div').copy().then(data => {})
|
|
*/
|
|
copy(): Chainable<{ [type: string]: any }>;
|
|
|
|
/**
|
|
* Cut command to dispatch cut event on subject
|
|
*
|
|
* @usage
|
|
* cy.get('div').cut().then(data => {})
|
|
*/
|
|
cut(): Chainable<{ [type: string]: any }>;
|
|
|
|
/**
|
|
* Calls EditorJS API render method
|
|
*
|
|
* @param data — data to render
|
|
*/
|
|
render(data: OutputData): Chainable<EditorJS>;
|
|
}
|
|
|
|
interface ApplicationWindow {
|
|
EditorJS: typeof EditorJS
|
|
}
|
|
}
|
|
}
|