mirror of
https://github.com/codex-team/editor.js
synced 2024-06-18 13:45:20 +02:00
Add notification if URL is not valid (#548)
This commit is contained in:
parent
71f8d76787
commit
3a9e4a814b
6
dist/codex-editor.js
vendored
6
dist/codex-editor.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "2.7.2",
|
||||
"version": "2.7.3",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "dist/codex-editor.js",
|
||||
"types": "./types/index.d.ts",
|
||||
|
|
|
@ -3,7 +3,7 @@ import SelectionUtils from '../selection';
|
|||
import $ from '../dom';
|
||||
import _ from '../utils';
|
||||
import {API, InlineTool, SanitizerConfig} from '../../../types';
|
||||
import {Toolbar} from '../../../types/api';
|
||||
import {Notifier, Toolbar} from '../../../types/api';
|
||||
/**
|
||||
* Link Tool
|
||||
*
|
||||
|
@ -84,11 +84,17 @@ export default class LinkInlineTool implements InlineTool {
|
|||
*/
|
||||
private inlineToolbar: Toolbar;
|
||||
|
||||
/**
|
||||
* Notifier API methods
|
||||
*/
|
||||
private notifier: Notifier;
|
||||
|
||||
/**
|
||||
* @param {{api: API}} - CodeX Editor API
|
||||
*/
|
||||
constructor({api}) {
|
||||
this.inlineToolbar = api.toolbar;
|
||||
this.notifier = api.notifier;
|
||||
this.selection = new SelectionUtils();
|
||||
}
|
||||
|
||||
|
@ -239,9 +245,12 @@ export default class LinkInlineTool implements InlineTool {
|
|||
}
|
||||
|
||||
if (!this.validateURL(value)) {
|
||||
/**
|
||||
* @todo show notification 'Incorrect Link'
|
||||
*/
|
||||
|
||||
this.notifier.show({
|
||||
message: 'Pasted link is not valid.',
|
||||
style: 'error',
|
||||
});
|
||||
|
||||
_.log('Incorrect Link pasted', 'warn', value);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue