@tinymce/tinymce-react
Advanced tools
Comparing version 4.3.3-feature.20240316201929904.sha241b7b5 to 4.3.3-feature.20240319234701135.sha3db60ba
@@ -7,4 +7,11 @@ import * as React from 'react'; | ||
type EditorOptions = Parameters<TinyMCE['init']>[0]; | ||
export type Version = `${'4' | '5' | '6' | '7'}${'' | '-dev' | '-testing' | `.${number}` | `.${number}.${number}`}`; | ||
export interface CloudHostedProps { | ||
apiKey: string; | ||
} | ||
export interface HybridOrSelfHostedProps { | ||
tinymceScriptSrc: string | string[] | ScriptItem[]; | ||
licenseKey: string; | ||
} | ||
export interface IProps { | ||
apiKey: string; | ||
id: string; | ||
@@ -15,5 +22,5 @@ inline: boolean; | ||
value: string; | ||
init: EditorOptions & Partial<Record<'selector' | 'target' | 'readonly', undefined>>; | ||
init: EditorOptions & Partial<Record<'selector' | 'target' | 'readonly' | 'license_key', undefined>>; | ||
tagName: string; | ||
cloudChannel: string; | ||
cloudChannel: Version; | ||
plugins: NonNullable<EditorOptions['plugins']>; | ||
@@ -23,3 +30,2 @@ toolbar: NonNullable<EditorOptions['toolbar']>; | ||
textareaName: string; | ||
tinymceScriptSrc: string | string[] | ScriptItem[]; | ||
rollback: number | false; | ||
@@ -32,4 +38,6 @@ scriptLoading: { | ||
} | ||
export interface IAllProps extends Partial<IProps>, Partial<IEvents> { | ||
} | ||
export type IAllProps = (CloudHostedProps | HybridOrSelfHostedProps) & Partial<IProps & IEvents>; | ||
/** | ||
* @see https://www.tiny.cloud/docs/tinymce/7/react-ref/ for the TinyMCE React Technical Reference | ||
*/ | ||
export declare class Editor extends React.Component<IAllProps> { | ||
@@ -46,3 +54,3 @@ static propTypes: IEditorPropTypes; | ||
private valueCursor; | ||
constructor(props: Partial<IAllProps>); | ||
constructor(props: IAllProps); | ||
private get view(); | ||
@@ -49,0 +57,0 @@ componentDidUpdate(prevProps: Partial<IAllProps>): void; |
@@ -35,2 +35,5 @@ "use strict"; | ||
var EditorPropTypes_1 = require("./EditorPropTypes"); | ||
/** | ||
* @see https://www.tiny.cloud/docs/tinymce/7/react-ref/ for the TinyMCE React Technical Reference | ||
*/ | ||
var Editor = /** @class */ (function (_super) { | ||
@@ -130,3 +133,3 @@ __extends(Editor, _super); | ||
} | ||
var finalInit = __assign(__assign({}, _this.props.init), { selector: undefined, target: target, readonly: _this.props.disabled, inline: _this.inline, plugins: (0, Utils_1.mergePlugins)((_a = _this.props.init) === null || _a === void 0 ? void 0 : _a.plugins, _this.props.plugins), toolbar: (_b = _this.props.toolbar) !== null && _b !== void 0 ? _b : (_c = _this.props.init) === null || _c === void 0 ? void 0 : _c.toolbar, setup: function (editor) { | ||
var finalInit = __assign(__assign(__assign(__assign({}, _this.props.init), { selector: undefined, target: target, readonly: _this.props.disabled, inline: _this.inline, plugins: (0, Utils_1.mergePlugins)((_a = _this.props.init) === null || _a === void 0 ? void 0 : _a.plugins, _this.props.plugins), toolbar: (_b = _this.props.toolbar) !== null && _b !== void 0 ? _b : (_c = _this.props.init) === null || _c === void 0 ? void 0 : _c.toolbar }), ('licenseKey' in _this.props && _this.props.licenseKey ? { license_key: _this.props.licenseKey } : {})), { setup: function (editor) { | ||
_this.editor = editor; | ||
@@ -252,3 +255,3 @@ _this.bindHandlers({}); | ||
} | ||
else if (Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0) { | ||
else if ('tinymceScriptSrc' in this.props && Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0) { | ||
(_b = (_a = this.props).onScriptsLoadError) === null || _b === void 0 ? void 0 : _b.call(_a, new Error('No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array.')); | ||
@@ -318,3 +321,3 @@ } | ||
var defer = (_b = this.props.scriptLoading) === null || _b === void 0 ? void 0 : _b.defer; | ||
if (this.props.tinymceScriptSrc !== undefined) { | ||
if ('tinymceScriptSrc' in this.props && this.props.tinymceScriptSrc !== undefined) { | ||
if (typeof this.props.tinymceScriptSrc === 'string') { | ||
@@ -336,4 +339,4 @@ return [{ src: this.props.tinymceScriptSrc, async: async, defer: defer }]; | ||
// fallback to the cloud when the tinymceScriptSrc is not specified | ||
var channel = this.props.cloudChannel; | ||
var apiKey = this.props.apiKey ? this.props.apiKey : 'no-api-key'; | ||
var channel = 'cloudChannel' in this.props && this.props.cloudChannel; | ||
var apiKey = 'apiKey' in this.props && this.props.apiKey ? this.props.apiKey : 'no-api-key'; | ||
var cloudTinyJs = "https://cdn.tiny.cloud/1/".concat(apiKey, "/tinymce/").concat(channel, "/tinymce.min.js"); | ||
@@ -340,0 +343,0 @@ return [{ src: cloudTinyJs, async: async, defer: defer }]; |
import * as PropTypes from 'prop-types'; | ||
import { IEvents } from '../Events'; | ||
import { IProps } from './Editor'; | ||
import { HybridOrSelfHostedProps, IProps, CloudHostedProps } from './Editor'; | ||
export type CopyProps<T> = { | ||
@@ -8,5 +8,5 @@ [P in keyof T]: PropTypes.Requireable<unknown>; | ||
export type IEventPropTypes = CopyProps<IEvents>; | ||
export interface IEditorPropTypes extends IEventPropTypes, CopyProps<IProps> { | ||
export interface IEditorPropTypes extends IEventPropTypes, CopyProps<IProps & CloudHostedProps & HybridOrSelfHostedProps> { | ||
} | ||
export declare const eventPropTypes: IEventPropTypes; | ||
export declare const EditorPropTypes: IEditorPropTypes; |
@@ -89,3 +89,3 @@ "use strict"; | ||
}; | ||
exports.EditorPropTypes = __assign({ apiKey: PropTypes.string, id: PropTypes.string, inline: PropTypes.bool, init: PropTypes.object, initialValue: PropTypes.string, onEditorChange: PropTypes.func, value: PropTypes.string, tagName: PropTypes.string, cloudChannel: PropTypes.string, plugins: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), toolbar: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), disabled: PropTypes.bool, textareaName: PropTypes.string, tinymceScriptSrc: PropTypes.oneOfType([ | ||
exports.EditorPropTypes = __assign({ apiKey: PropTypes.string, licenseKey: PropTypes.string, id: PropTypes.string, inline: PropTypes.bool, init: PropTypes.object, initialValue: PropTypes.string, onEditorChange: PropTypes.func, value: PropTypes.string, tagName: PropTypes.string, cloudChannel: PropTypes.string, plugins: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), toolbar: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), disabled: PropTypes.bool, textareaName: PropTypes.string, tinymceScriptSrc: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
@@ -92,0 +92,0 @@ PropTypes.arrayOf(PropTypes.string), |
@@ -7,4 +7,11 @@ import * as React from 'react'; | ||
type EditorOptions = Parameters<TinyMCE['init']>[0]; | ||
export type Version = `${'4' | '5' | '6' | '7'}${'' | '-dev' | '-testing' | `.${number}` | `.${number}.${number}`}`; | ||
export interface CloudHostedProps { | ||
apiKey: string; | ||
} | ||
export interface HybridOrSelfHostedProps { | ||
tinymceScriptSrc: string | string[] | ScriptItem[]; | ||
licenseKey: string; | ||
} | ||
export interface IProps { | ||
apiKey: string; | ||
id: string; | ||
@@ -15,5 +22,5 @@ inline: boolean; | ||
value: string; | ||
init: EditorOptions & Partial<Record<'selector' | 'target' | 'readonly', undefined>>; | ||
init: EditorOptions & Partial<Record<'selector' | 'target' | 'readonly' | 'license_key', undefined>>; | ||
tagName: string; | ||
cloudChannel: string; | ||
cloudChannel: Version; | ||
plugins: NonNullable<EditorOptions['plugins']>; | ||
@@ -23,3 +30,2 @@ toolbar: NonNullable<EditorOptions['toolbar']>; | ||
textareaName: string; | ||
tinymceScriptSrc: string | string[] | ScriptItem[]; | ||
rollback: number | false; | ||
@@ -32,4 +38,6 @@ scriptLoading: { | ||
} | ||
export interface IAllProps extends Partial<IProps>, Partial<IEvents> { | ||
} | ||
export type IAllProps = (CloudHostedProps | HybridOrSelfHostedProps) & Partial<IProps & IEvents>; | ||
/** | ||
* @see https://www.tiny.cloud/docs/tinymce/7/react-ref/ for the TinyMCE React Technical Reference | ||
*/ | ||
export declare class Editor extends React.Component<IAllProps> { | ||
@@ -46,3 +54,3 @@ static propTypes: IEditorPropTypes; | ||
private valueCursor; | ||
constructor(props: Partial<IAllProps>); | ||
constructor(props: IAllProps); | ||
private get view(); | ||
@@ -49,0 +57,0 @@ componentDidUpdate(prevProps: Partial<IAllProps>): void; |
@@ -32,2 +32,5 @@ var __extends = (this && this.__extends) || (function () { | ||
import { EditorPropTypes } from './EditorPropTypes'; | ||
/** | ||
* @see https://www.tiny.cloud/docs/tinymce/7/react-ref/ for the TinyMCE React Technical Reference | ||
*/ | ||
var Editor = /** @class */ (function (_super) { | ||
@@ -127,3 +130,3 @@ __extends(Editor, _super); | ||
} | ||
var finalInit = __assign(__assign({}, _this.props.init), { selector: undefined, target: target, readonly: _this.props.disabled, inline: _this.inline, plugins: mergePlugins((_a = _this.props.init) === null || _a === void 0 ? void 0 : _a.plugins, _this.props.plugins), toolbar: (_b = _this.props.toolbar) !== null && _b !== void 0 ? _b : (_c = _this.props.init) === null || _c === void 0 ? void 0 : _c.toolbar, setup: function (editor) { | ||
var finalInit = __assign(__assign(__assign(__assign({}, _this.props.init), { selector: undefined, target: target, readonly: _this.props.disabled, inline: _this.inline, plugins: mergePlugins((_a = _this.props.init) === null || _a === void 0 ? void 0 : _a.plugins, _this.props.plugins), toolbar: (_b = _this.props.toolbar) !== null && _b !== void 0 ? _b : (_c = _this.props.init) === null || _c === void 0 ? void 0 : _c.toolbar }), ('licenseKey' in _this.props && _this.props.licenseKey ? { license_key: _this.props.licenseKey } : {})), { setup: function (editor) { | ||
_this.editor = editor; | ||
@@ -249,3 +252,3 @@ _this.bindHandlers({}); | ||
} | ||
else if (Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0) { | ||
else if ('tinymceScriptSrc' in this.props && Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0) { | ||
(_b = (_a = this.props).onScriptsLoadError) === null || _b === void 0 ? void 0 : _b.call(_a, new Error('No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array.')); | ||
@@ -315,3 +318,3 @@ } | ||
var defer = (_b = this.props.scriptLoading) === null || _b === void 0 ? void 0 : _b.defer; | ||
if (this.props.tinymceScriptSrc !== undefined) { | ||
if ('tinymceScriptSrc' in this.props && this.props.tinymceScriptSrc !== undefined) { | ||
if (typeof this.props.tinymceScriptSrc === 'string') { | ||
@@ -333,4 +336,4 @@ return [{ src: this.props.tinymceScriptSrc, async: async, defer: defer }]; | ||
// fallback to the cloud when the tinymceScriptSrc is not specified | ||
var channel = this.props.cloudChannel; | ||
var apiKey = this.props.apiKey ? this.props.apiKey : 'no-api-key'; | ||
var channel = 'cloudChannel' in this.props && this.props.cloudChannel; | ||
var apiKey = 'apiKey' in this.props && this.props.apiKey ? this.props.apiKey : 'no-api-key'; | ||
var cloudTinyJs = "https://cdn.tiny.cloud/1/".concat(apiKey, "/tinymce/").concat(channel, "/tinymce.min.js"); | ||
@@ -337,0 +340,0 @@ return [{ src: cloudTinyJs, async: async, defer: defer }]; |
import * as PropTypes from 'prop-types'; | ||
import { IEvents } from '../Events'; | ||
import { IProps } from './Editor'; | ||
import { HybridOrSelfHostedProps, IProps, CloudHostedProps } from './Editor'; | ||
export type CopyProps<T> = { | ||
@@ -8,5 +8,5 @@ [P in keyof T]: PropTypes.Requireable<unknown>; | ||
export type IEventPropTypes = CopyProps<IEvents>; | ||
export interface IEditorPropTypes extends IEventPropTypes, CopyProps<IProps> { | ||
export interface IEditorPropTypes extends IEventPropTypes, CopyProps<IProps & CloudHostedProps & HybridOrSelfHostedProps> { | ||
} | ||
export declare const eventPropTypes: IEventPropTypes; | ||
export declare const EditorPropTypes: IEditorPropTypes; |
@@ -86,3 +86,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
export var EditorPropTypes = __assign({ apiKey: PropTypes.string, id: PropTypes.string, inline: PropTypes.bool, init: PropTypes.object, initialValue: PropTypes.string, onEditorChange: PropTypes.func, value: PropTypes.string, tagName: PropTypes.string, cloudChannel: PropTypes.string, plugins: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), toolbar: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), disabled: PropTypes.bool, textareaName: PropTypes.string, tinymceScriptSrc: PropTypes.oneOfType([ | ||
export var EditorPropTypes = __assign({ apiKey: PropTypes.string, licenseKey: PropTypes.string, id: PropTypes.string, inline: PropTypes.bool, init: PropTypes.object, initialValue: PropTypes.string, onEditorChange: PropTypes.func, value: PropTypes.string, tagName: PropTypes.string, cloudChannel: PropTypes.string, plugins: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), toolbar: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), disabled: PropTypes.bool, textareaName: PropTypes.string, tinymceScriptSrc: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
@@ -89,0 +89,0 @@ PropTypes.arrayOf(PropTypes.string), |
@@ -30,3 +30,3 @@ { | ||
"prop-types": "^15.6.2", | ||
"tinymce": "^6.0.0 || ^5.5.1" | ||
"tinymce": "^7.0.0 || ^6.0.0 || ^5.5.1" | ||
}, | ||
@@ -74,4 +74,4 @@ "peerDependencies": { | ||
}, | ||
"version": "4.3.3-feature.20240316201929904.sha241b7b5", | ||
"version": "4.3.3-feature.20240319234701135.sha3db60ba", | ||
"name": "@tinymce/tinymce-react" | ||
} |
98985
1818
+ Addedtinymce@7.6.1(transitive)
- Removedtinymce@6.8.5(transitive)