inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
*/
import type { IDictionary } from "../../types/index";
import type { ISpeechRecognizeConstructor } from "./interface";
declare module 'jodit/config' {
interface Config {
speechRecognize: {
readonly api: ISpeechRecognizeConstructor | null;
/**
* Returns and sets the language of the current SpeechRecognition.
* If not specified, this defaults to the HTML lang attribute value, or
* the user agent's language setting if that isn't set either.
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/lang
*/
readonly lang?: string;
/**
* Controls whether continuous results are returned for each recognition,
* or only a single result.
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/continuous
*/
readonly continuous: boolean;
/**
* Controls whether interim results should be returned (true) or not (false.)
* Interim results are results that are not yet final (e.g. the isFinal property is false.)
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/interimResults
*/
readonly interimResults: boolean;
/**
* On recognition error - make an error sound
*/
readonly sound: boolean;
/**
* You can specify any commands in your language by listing them with the `|` sign.
* In the value, write down any commands for
* [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#parameters)
* and value (separated by ::)
* You can also use [custom Jodit commands](#need-article)
* For example
* ```js
* Jodit.make('#editor', {
* speechRecognize: {
* commands: {
* 'remove line|remove paragraph': 'backspaceSentenceButton',
* 'start bold': 'bold',
* 'insert table|create table': 'insertHTML::<table><tr><td>test</td></tr></table>',
* }
* }
* });
* ```
*/
readonly commands: IDictionary<string>;
};
}
}

View File

@@ -0,0 +1,106 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isBoolean } from "../../core/helpers/checker/is-boolean.js";
import { isString } from "../../core/helpers/checker/is-string.js";
import { attr } from "../../core/helpers/utils/attr.js";
import { dataBind } from "../../core/helpers/utils/data-bind.js";
import { Icon } from "../../core/ui/icon.js";
import { Config } from "../../config.js";
import { SpeechRecognition } from "./helpers/api.js";
import { RecognizeManager } from "./helpers/recognize-manager.js";
import speechRecognizeIcon from "./speech-recognize.svg.js";
Config.prototype.speechRecognize = {
api: typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : null,
sound: true,
continuous: false,
interimResults: true,
commands: {
'newline|enter': 'enter',
'delete|remove word|delete word': 'backspaceWordButton',
comma: 'inserthtml::,',
underline: 'inserthtml::_',
hyphen: 'inserthtml::-',
space: 'inserthtml:: ',
question: 'inserthtml::?',
dot: 'inserthtml::.',
'quote|quotes|open quote': "inserthtml::'",
'header|header h1': 'formatblock::h1',
'select all': 'selectall'
}
};
Icon.set('speech-recognize', speechRecognizeIcon);
Config.prototype.controls.speechRecognize = {
isVisible(j) {
return Boolean(j.o.speechRecognize.api);
},
isActive(jodit, _) {
const api = dataBind(jodit, 'speech');
return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
},
isDisabled(jodit) {
return !jodit.o.speechRecognize.api;
},
exec(jodit, current, { button, control }) {
var _a;
const { api: ApiConstructor, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
if (!ApiConstructor) {
jodit.alert('Speech recognize API unsupported in your browser');
return;
}
let api = dataBind(jodit, 'speech');
if (!api) {
const nativeApi = new ApiConstructor();
api = new RecognizeManager(jodit.async, nativeApi);
api.lang = isString(lang)
? lang
: ((_a = attr(jodit.od.documentElement, 'lang')) !== null && _a !== void 0 ? _a : undefined);
api.continuous = continuous;
api.interimResults = interimResults;
api.sound = sound;
dataBind(jodit, 'speech', api);
api.on('pulse', (enable) => {
button.setMod('pulse', enable);
});
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
api.on('error', (text) => jodit.message.error(text));
button.hookStatus('beforeDestruct', () => {
dataBind(jodit, 'speech', null);
api.destruct();
});
}
if (control.args) {
const key = control.args[0];
if (isBoolean(api[key])) {
api[key] = !api[key];
if (api.isEnabled) {
api.restart();
}
return;
}
}
api.toggle();
if (api.isEnabled) {
button.setMod('pulse', true);
}
button.state.activated = api.isEnabled;
},
name: 'speechRecognize',
command: 'toggleSpeechRecognize',
tooltip: 'Speech Recognize',
list: {
sound: 'Sound',
interimResults: 'Interim Results'
},
childTemplate(jodit, key, value) {
var _a;
const api = dataBind(jodit, 'speech'), checked = (_a = api === null || api === void 0 ? void 0 : api[key]) !== null && _a !== void 0 ? _a : jodit.o.speechRecognize[key];
return `<span class='jodit-speech-recognize__list-item'><input ${checked ? 'checked' : ''} class='jodit-checkbox' type='checkbox'>&nbsp;${value}</span>`;
},
mods: {
stroke: false
}
};

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
* @internal
*/
export declare const PII = 440;
export declare const WARN = 940;

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
* @internal
*/
export const PII = 440;
export const WARN = 940;

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
*/
import type { ISpeechRecognizeConstructor } from "../interface";
export declare const SpeechRecognition: ISpeechRecognizeConstructor | undefined;

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { globalWindow } from "../../../core/constants.js";
export const SpeechRecognition = globalWindow
? globalWindow.SpeechRecognition ||
globalWindow.webkitSpeechRecognition
: undefined;

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
*/
import type { IJodit } from "../../../types/index";
export declare function execSpellCommand(jodit: IJodit, commandSentence: string): void;

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export function execSpellCommand(jodit, commandSentence) {
const [command, value] = commandSentence.split('::');
jodit.execCommand(command, null, value);
}

View File

@@ -0,0 +1,49 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
*/
import type { CanUndef, IAsync, IDestructible } from "../../../types/index";
import type { ISpeechRecognize } from "../interface";
import { Eventify } from "../../../core/event-emitter/eventify";
export declare class RecognizeManager extends Eventify<{
pulse: (enable: boolean) => void;
result: (text: string) => void;
progress: (text: string) => void;
error: () => void;
sound: (type: number) => void;
}> implements IDestructible {
private async;
private _lang;
set lang(v: CanUndef<string>);
get lang(): CanUndef<string>;
private _continuous;
set continuous(v: boolean);
get continuous(): boolean;
private _interimResults;
set interimResults(v: boolean);
get interimResults(): boolean;
sound: boolean;
constructor(async: IAsync, api: ISpeechRecognize);
private static _instances;
destruct(): void;
private _isEnabled;
get isEnabled(): boolean;
start(): void;
stop(): void;
toggle(): void;
restart(): void;
private _restartTimeout;
private _onSpeechStart;
private readonly _api;
private __on;
private __off;
private _onResults;
private __interimResults;
private _onProgress;
private _onError;
private _makeSound;
}

View File

@@ -0,0 +1,188 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { autobind } from "../../../core/decorators/index.js";
import { Eventify } from "../../../core/event-emitter/eventify.js";
import { sound } from "./sound.js";
import { PII, WARN } from "../constants.js";
export class RecognizeManager extends Eventify {
set lang(v) {
this._lang = v;
this._api.lang = v;
}
get lang() {
return this._lang;
}
set continuous(v) {
this._continuous = v;
this._api.continuous = v;
}
get continuous() {
return this._continuous;
}
set interimResults(v) {
this._interimResults = v;
this._api.interimResults = v;
}
get interimResults() {
return this._interimResults;
}
constructor(async, api) {
super();
this.async = async;
this._continuous = false;
this._interimResults = false;
this.sound = true;
this._isEnabled = false;
this._restartTimeout = 0;
this._onSpeechStart = (e) => {
if (!this._isEnabled) {
return;
}
this.async.clearTimeout(this._restartTimeout);
this._restartTimeout = this.async.setTimeout(() => {
this.restart();
this.emit('pulse', false);
this._makeSound(WARN);
}, 5000);
this.emit('pulse', true);
};
this.__interimResults = '';
this._api = api;
RecognizeManager._instances.add(this);
}
destruct() {
this.stop();
RecognizeManager._instances.delete(this);
super.destruct();
}
get isEnabled() {
return this._isEnabled;
}
start() {
if (this._isEnabled) {
return;
}
this._isEnabled = true;
RecognizeManager._instances.forEach(instance => {
if (instance !== this) {
instance.stop();
}
});
try {
this._api.start();
}
catch (e) {
this._onError(e);
this.stop();
return;
}
this.__on('speechstart', this._onSpeechStart)
.__on('error', this._onError)
.__on('result', this._onProgress)
.__on('end', this._onResults);
}
stop() {
if (!this._isEnabled) {
return;
}
this._api.abort();
this._api.stop();
this.__off('speechstart', this._onSpeechStart)
.__off('error', this._onError)
.__off('result', this._onProgress)
.__off('end', this._onResults);
this.async.clearTimeout(this._restartTimeout);
this._isEnabled = false;
this.emit('pulse', false);
}
toggle() {
if (!this._isEnabled) {
this.start();
}
else {
this.stop();
}
}
restart() {
this.stop();
this.start();
}
__on(event, callback) {
this._api.addEventListener(event, callback);
return this;
}
__off(event, callback) {
this._api.removeEventListener(event, callback);
return this;
}
_onResults(e) {
this.emit('pulse', false);
this.emit('result', this.__interimResults);
this.__interimResults = '';
this._makeSound(PII);
this.restart();
}
_onProgress(e) {
if (!this._isEnabled) {
return;
}
this.__interimResults = '';
if (!e.results) {
return;
}
for (let i = 0; i < e.results.length; i++) {
const resultItem = e.results.item(i);
if (resultItem.length) {
const { transcript } = resultItem.item(0);
this.__interimResults += transcript;
}
}
if (this.__interimResults) {
this.emit('progress', this.__interimResults);
}
}
_onError(e) {
if (e.error === 'voice-unavailable') {
this.emit('error', 'Voice unavailable');
}
if (e.error === 'not-allowed') {
this.emit('error', 'Not allowed');
}
if (e.error === 'language-unavailable' ||
// @ts-ignore
e.error === 'language-not-supported') {
this.emit('error', 'Language unavailable');
}
this._makeSound(WARN);
this.emit('pulse', false);
this.stop();
}
_makeSound(frequency) {
if (this.sound) {
sound({ frequency });
}
}
}
RecognizeManager._instances = new Set();
__decorate([
autobind
], RecognizeManager.prototype, "_onResults", null);
__decorate([
autobind
], RecognizeManager.prototype, "_onProgress", null);
__decorate([
autobind
], RecognizeManager.prototype, "_onError", null);

View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @internal
*/
export declare function sound({ sec, frequency, gain, type }?: {
sec?: number;
frequency?: number;
gain?: number;
type?: 'sine' | 'square' | 'sawtooth' | 'triangle';
}): void;

View File

@@ -0,0 +1,32 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
*/
import { globalWindow } from "../../../core/constants.js";
import { PII } from "../constants.js";
/**
* @internal
*/
export function sound({ sec = 0.1, frequency = PII, gain = 0.1, type = 'sine' } = {}) {
if (!globalWindow ||
(typeof globalWindow.AudioContext === 'undefined' &&
typeof globalWindow.webkitAudioContext === 'undefined')) {
return;
}
// one context per document
const context = new (globalWindow.AudioContext ||
globalWindow.webkitAudioContext)();
const vol = context.createGain();
const osc = context.createOscillator();
osc.type = type;
osc.frequency.value = frequency; // Hz
osc.connect(vol);
vol.connect(context.destination);
osc.start(); // start the oscillator
osc.stop(context.currentTime + sec);
vol.gain.value = gain;
}

View File

@@ -0,0 +1,44 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module plugins/speech-recognize
*/
export interface ISpeechRecognizeResult {
resultIndex: number;
results: {
item(index: number): {
isFinal?: boolean;
item(subIndex: number): {
transcript: string;
};
length: number;
};
length: number;
};
}
export interface ISpeechRecognize {
addEventListener(event: 'result', e: (result: ISpeechRecognizeResult) => void): void;
addEventListener(event: string, e: Function): void;
removeEventListener(event: string, e: Function): void;
/**
* https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/lang
*/
lang?: string;
/**
* https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/interimResults
*/
interimResults: boolean;
/**
* https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/continuous
*/
continuous: boolean;
start(): void;
abort(): void;
stop(): void;
}
export interface ISpeechRecognizeConstructor {
new (): ISpeechRecognize;
}

View File

@@ -0,0 +1,6 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export {};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'الخط الجديد',
delete: 'حذف',
space: 'الفضاء',
'Speech Recognize': 'التعرف على الكلام',
Sound: 'الصوت',
'Interim Results': 'النتائج المؤقتة'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'řádek',
delete: 'odstranit',
space: 'prostora',
'Speech Recognize': 'Rozpoznání Řeči',
Sound: 'Zvuk',
'Interim Results': 'Průběžné Výsledky'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'Zeilenumbruch',
delete: 'löschen',
space: 'Raum',
'Speech Recognize': 'Sprache Erkennen',
Sound: 'Sound',
'Interim Results': 'Zwischenergebnis'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'nueva línea',
delete: 'eliminar',
space: 'espacio',
'Speech Recognize': 'Reconocimiento de Voz',
Sound: 'Sonido',
'Interim Results': 'Resultados Provisionales'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'خط جدید',
delete: 'حذف',
space: 'فضا',
'Speech Recognize': 'گفتار را تشخیص دهید',
Sound: 'صدا',
'Interim Results': 'نتایج موقت'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
'Speech Recognize': string;
newline: string;
delete: string;
space: string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
'Speech Recognize': 'Puheentunnistus',
newline: 'uusi rivi',
delete: 'poistaa',
space: 'tilaa',
Sound: 'Ääni',
'Interim Results': 'Välitulokset'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'nouvelle ligne',
delete: 'supprimer',
space: 'espace',
'Speech Recognize': 'Reconnaissance Vocale',
Sound: 'Son',
'Interim Results': 'Résultats Intermédiaires'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'חדשות',
delete: 'מחק',
space: 'שטח',
'Speech Recognize': 'דיבור מזהה',
Sound: 'קול',
'Interim Results': 'תוצאות ביניים'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'újsor',
delete: 'törlés',
space: 'tér',
'Speech Recognize': 'A Beszéd Felismeri',
Sound: 'Hang',
'Interim Results': 'Időközi Eredmények'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'newline',
delete: 'Hapus',
space: 'ruang',
'Speech Recognize': 'Pidato Mengenali',
Sound: 'Suara',
'Interim Results': 'Hasil Sementara'
};

View File

@@ -0,0 +1,29 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import * as ar from "./ar";
import * as cs_cz from "./cs_cz";
import * as de from "./de";
import * as es from "./es";
import * as fa from "./fa";
import * as fi from "./fi";
import * as fr from "./fr";
import * as he from "./he";
import * as hu from "./hu";
import * as id from "./id";
import * as it from "./it";
import * as ja from "./ja";
import * as ko from "./ko";
import * as mn from "./mn";
import * as nl from "./nl";
import * as no from "./no";
import * as pl from "./pl";
import * as pt_br from "./pt_br";
import * as ru from "./ru";
import * as tr from "./tr";
import * as ua from "./ua";
import * as zh_cn from "./zh_cn";
import * as zh_tw from "./zh_tw";
export { ar, cs_cz, de, es, fa, fi, fr, he, hu, id, it, ja, ko, mn, nl, no, pl, pt_br, ru, tr, ua, zh_cn, zh_tw };

View File

@@ -0,0 +1,30 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
// @ts-nocheck
import * as ar from "./ar.js";
import * as cs_cz from "./cs_cz.js";
import * as de from "./de.js";
import * as es from "./es.js";
import * as fa from "./fa.js";
import * as fi from "./fi.js";
import * as fr from "./fr.js";
import * as he from "./he.js";
import * as hu from "./hu.js";
import * as id from "./id.js";
import * as it from "./it.js";
import * as ja from "./ja.js";
import * as ko from "./ko.js";
import * as mn from "./mn.js";
import * as nl from "./nl.js";
import * as no from "./no.js";
import * as pl from "./pl.js";
import * as pt_br from "./pt_br.js";
import * as ru from "./ru.js";
import * as tr from "./tr.js";
import * as ua from "./ua.js";
import * as zh_cn from "./zh_cn.js";
import * as zh_tw from "./zh_tw.js";
export { ar, cs_cz, de, es, fa, fi, fr, he, hu, id, it, ja, ko, mn, nl, no, pl, pt_br, ru, tr, ua, zh_cn, zh_tw };

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'nuova riga',
delete: 'eliminare',
space: 'spazio',
'Speech Recognize': 'Discorso Riconoscere',
Sound: 'Suono',
'Interim Results': 'Risultati intermedi'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: '改行',
delete: '削除',
space: 'スペース',
'Speech Recognize': '音声認識',
Sound: '音',
'Interim Results': '中間結果'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: '줄 바꿈',
delete: '삭제',
space: '공간',
'Speech Recognize': '음성 인식',
Sound: '소리',
'Interim Results': '중간 결과'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'Шинэ мөр',
delete: 'Устгах',
space: 'Зай',
'Speech Recognize': 'Дуу хоолой таних',
Sound: 'Дуу',
'Interim Results': 'Түр зуурын үр дүн'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'regel',
delete: 'verwijderen',
space: 'ruimte',
'Speech Recognize': 'Spraak Herkennen',
Sound: 'Geluid',
'Interim Results': 'Tussentijdse Resultaten'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'nylinje',
delete: 'slette',
space: 'rom',
'Speech Recognize': 'Talegjenkjenning',
Sound: 'Lyd',
'Interim Results': 'Midlertidige resultater'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'newline',
delete: 'usunąć',
space: 'przestrzeń',
'Speech Recognize': 'Rozpoznawanie Mowy',
Sound: 'Dźwięk',
'Interim Results': 'Wyniki Okresowe'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'linha',
delete: 'excluir',
space: 'espaco',
'Speech Recognize': 'Discurso Reconhecer',
Sound: 'Som',
'Interim Results': 'Resultados Provisórios'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'новая строка|перенос|энтер',
delete: 'удалить',
space: 'пробел',
'Speech Recognize': 'Распознавание речи',
Sound: 'Звук',
'Interim Results': 'Промежуточные результаты'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'yeni satır',
delete: 'silmek',
space: 'uzay',
'Speech Recognize': 'Konuşma Tanıma',
Sound: 'Ses',
'Interim Results': 'Ara Sonuçlar'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: 'новая строка|перенос|ентер',
delete: 'видалити',
space: 'пробел',
'Speech Recognize': 'Распознавание речи',
Sound: 'Звук',
'Interim Results': 'Проміжні результати'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: '新行',
delete: '删除',
space: '空间',
'Speech Recognize': '言语识别',
Sound: '声音',
'Interim Results': '中期业绩'
};

View File

@@ -0,0 +1,9 @@
declare const _exports: {
newline: string;
delete: string;
space: string;
'Speech Recognize': string;
Sound: string;
'Interim Results': string;
};
export = _exports;

View File

@@ -0,0 +1,14 @@
"use strict";
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export default {
newline: '換行',
delete: '刪除',
space: '空白',
'Speech Recognize': '語音辨識',
Sound: '聲音',
'Interim Results': '階段性辨識結果'
};

View File

@@ -0,0 +1,27 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:plugins/speech-recognize/README.md]]
* @packageDocumentation
* @module plugins/speech-recognize
*/
import type { IJodit, IPlugin } from "../../types/index";
import { Plugin } from "../../core/plugin/index";
import "./config";
export declare class SpeechRecognizeNative extends Plugin implements IPlugin {
buttons: {
group: string;
name: string;
}[];
protected afterInit(jodit: IJodit): void;
protected beforeDestruct(jodit: IJodit): void;
private messagePopup;
private __hidePopupTimeout;
protected onSpeechRecognizeProgressResult(text: string): void;
protected onSpeechRecognizeResult(text: string): void;
private _checkCommand;
private _commandToWord;
}

View File

@@ -0,0 +1,109 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { watch } from "../../core/decorators/watch/watch.js";
import { Dom } from "../../core/dom/dom.js";
import { extendLang } from "../../core/global.js";
import { keys } from "../../core/helpers/utils/utils.js";
import { Plugin } from "../../core/plugin/index.js";
import "./config.js";
import { Jodit } from "../../jodit.js";
import { execSpellCommand } from "./helpers/exec-spell-command.js";
import * as langs from "./langs/index.js";
export class SpeechRecognizeNative extends Plugin {
constructor() {
super(...arguments);
this.buttons = [
{
group: 'state',
name: 'speechRecognize'
}
];
this._commandToWord = {};
}
afterInit(jodit) {
const { commands } = jodit.o.speechRecognize;
if (commands) {
extendLang(langs);
keys(commands, false).forEach(words => {
const keys = words.split('|');
keys.forEach(key => {
key = key.trim().toLowerCase();
this._commandToWord[key] = commands[words];
const translatedKeys = jodit.i18n(key);
if (translatedKeys !== key) {
translatedKeys.split('|').forEach(translatedKey => {
this._commandToWord[translatedKey.trim().toLowerCase()] = commands[words].trim();
});
}
});
});
}
}
beforeDestruct(jodit) {
Dom.safeRemove(this.messagePopup);
}
onSpeechRecognizeProgressResult(text) {
if (!this.messagePopup) {
this.messagePopup = this.j.create.div('jodit-speech-recognize__popup');
}
this.j.workplace.appendChild(this.messagePopup);
this.j.async.clearTimeout(this.__hidePopupTimeout);
this.__hidePopupTimeout = this.j.async.setTimeout(() => {
Dom.safeRemove(this.messagePopup);
}, 1000);
this.messagePopup.innerText = text + '|';
}
onSpeechRecognizeResult(text) {
this.j.async.clearTimeout(this.__hidePopupTimeout);
Dom.safeRemove(this.messagePopup);
const { j } = this;
const { s } = j;
if (!this._checkCommand(text)) {
const { range } = s, node = s.current();
if (s.isCollapsed() &&
Dom.isText(node) &&
Dom.isOrContains(j.editor, node) &&
node.nodeValue) {
const sentence = node.nodeValue;
node.nodeValue =
sentence +
(/[\u00A0 ]\uFEFF*$/.test(sentence) ? '' : ' ') +
text;
range.setStartAfter(node);
s.selectRange(range);
j.synchronizeValues();
}
else {
s.insertHTML(text);
}
}
}
_checkCommand(command) {
command = command.toLowerCase().replace(/\./g, '');
if (this._commandToWord[command]) {
execSpellCommand(this.j, this._commandToWord[command]);
return true;
}
return false;
}
}
__decorate([
watch(':speechRecognizeProgressResult')
], SpeechRecognizeNative.prototype, "onSpeechRecognizeProgressResult", null);
__decorate([
watch(':speechRecognizeResult')
], SpeechRecognizeNative.prototype, "onSpeechRecognizeResult", null);
Jodit.plugins.add('speech-recognize', SpeechRecognizeNative);

View File

@@ -0,0 +1 @@
export default "<svg viewBox=\"0 0 16 16\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M8,11c1.657,0,3-1.343,3-3V3c0-1.657-1.343-3-3-3S5,1.343,5,3v5C5,9.657,6.343,11,8,11z\"/> <path d=\"M13,8V6h-1l0,1.844c0,1.92-1.282,3.688-3.164,4.071C6.266,12.438,4,10.479,4,8V6H3v2c0,2.414,1.721,4.434,4,4.899V15H5v1h6 v-1H9v-2.101C11.279,12.434,13,10.414,13,8z\"/> </svg> ";