Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const unwrap = (data: DialogData): MediaData => {
const unwrapped = Merger.merge(data, {
source1: data.source1.value,
source2: Obj.get(data, 'source2').bind((source2) => Obj.get(source2, 'value')).getOr(''),
poster: Obj.get(data, 'poster').bind((poster) => Obj.get(poster, 'value')).getOr('')
});
// Add additional size values that may or may not have been in the data
Obj.get(data, 'dimensions').each((dimensions) => {
Arr.each([ 'width', 'height' ] as ('width' | 'height')[], (prop) => {
Obj.get(dimensions, prop).each((value) => unwrapped[prop] = value);
});
});
return unwrapped;
};
return Obj.map(userDefinedEmoticons, (value: RawEmojiEntry) => {
// Set some sane defaults for the custom emoji entry
return Merger.merge({ keywords: [], category: 'user' }, value);
});
};
const wrap = (data: MediaData): DialogData => {
const wrapped = Merger.merge(data, {
source1: { value: Obj.get(data, 'source1').getOr('') },
source2: { value: Obj.get(data, 'source2').getOr('') },
poster: { value: Obj.get(data, 'poster').getOr('') }
});
// Add additional size values that may or may not have been in the html
Arr.each([ 'width', 'height' ] as (keyof MediaData)[], (prop) => {
Obj.get(data, prop).each((value) => {
const dimensions = wrapped.dimensions || {};
dimensions[prop] = value;
wrapped.dimensions = dimensions;
});
});
return wrapped;
};
Resource.load(databaseId, databaseUrl).then((emojis) => {
const userEmojis = getUserDefinedEmoticons(editor);
processEmojis(Merger.merge(emojis, userEmojis));
}, (err) => {
// tslint:disable-next-line:no-console
return ctx.type === 'contexttoolbar' ? (() => {
const allButtons = Merger.merge(buttons, scopes.formNavigators);
const initGroups = identifyButtons(editor, { buttons: allButtons, toolbar: ctx.items }, extras, Option.some([ 'form:' ]));
return renderToolbar({
uid: Id.generate('context-toolbar'),
initGroups,
onEscape: Option.none,
cyclicKeying: true,
backstage: extras.backstage,
getSink: () => Result.error('')
});
})() : (() => {
return ContextForm.renderContextForm(ctx, extras.backstage);
});
if (hasAdvancedTableTab(editor)) {
styleTDTH(dom, tableElm.children[i], {
'border-color': data.bordercolor,
});
}
}
}
if (hasAdvancedTableTab(editor)) {
styles['background-color'] = data.backgroundcolor;
styles['border-color'] = data.bordercolor;
styles['border-style'] = data.borderstyle;
}
attrs.style = dom.serializeStyle(Merger.merge(getDefaultStyles(editor), styles));
dom.setAttribs(tableElm, Merger.merge(getDefaultAttributes(editor), attrs));
};
if (hasAdvancedTableTab(editor)) {
styleTDTH(dom, tableElm.children[i], {
'border-color': data.bordercolor,
});
}
}
}
if (hasAdvancedTableTab(editor)) {
styles['background-color'] = data.backgroundcolor;
styles['border-color'] = data.bordercolor;
styles['border-style'] = data.borderstyle;
}
attrs.style = dom.serializeStyle(Merger.merge(getDefaultStyles(editor), styles));
dom.setAttribs(tableElm, Merger.merge(getDefaultAttributes(editor), attrs));
};