Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit

Permalink
fix: custom size of the iframe with fileds data
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvente committed Feb 13, 2024
1 parent 6f38272 commit a33a140
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ function tinyMCEEmbedIframePlugin(editor) {
onChange(api, field) {
const { name } = field;
const data = api.getData();
const { sizeType } = data;
const { sizeType, ...fields } = data;
const isSizeTypeFiled = name === 'sizeType';
const hasCustomSize = sizeType === 'inline';

if (sizeType !== 'inline' && name === 'sizeType') {
if (!hasCustomSize && isSizeTypeFiled) {
const {
body: {
tabs: [generalTab],
Expand All @@ -102,11 +104,11 @@ function tinyMCEEmbedIframePlugin(editor) {
(item) => item.type !== 'sizeinput',
);

defaultConfig.initialData = { sizeType };
defaultConfig.initialData = { ...fields, sizeType };
api.redial(defaultConfig);
}

if (sizeType === 'inline' && name === 'sizeType') {
if (hasCustomSize && isSizeTypeFiled) {
const {
body: {
tabs: [generalTab],
Expand All @@ -126,7 +128,7 @@ function tinyMCEEmbedIframePlugin(editor) {
];
}

defaultConfig.initialData = { sizeType };
defaultConfig.initialData = { ...fields, sizeType };
api.redial(defaultConfig);
}
},
Expand Down

0 comments on commit a33a140

Please sign in to comment.