Implement symbols - Add, Remove, Select Container - Form - Link with container - Symbol behavior application to container (move to x with xpositionreference) Important changes - Remove SelectedContainer from HistoryState, meaning that it will be slower for each load but will be faster for each operations* (SetHistory, SelectContainer, DeleteContainer, SymbolOperations) - ElementsSidebar now opens with isSidebarOpen meaning that both sidebar will open on toggle - Moved camelize, transformX, restoreX to different modules (stringtools.ts, svg.ts)
22 lines
428 B
JavaScript
22 lines
428 B
JavaScript
onmessage = (e) => {
|
|
const data = JSON.stringify(e.data.editorState, getCircularReplacer(), e.data.spaces);
|
|
postMessage(data);
|
|
};
|
|
|
|
const getCircularReplacer = () => {
|
|
return (key, value) => {
|
|
if (key === 'parent') {
|
|
return;
|
|
}
|
|
|
|
if (key === 'Symbols') {
|
|
return Array.from(value.entries());
|
|
}
|
|
|
|
if (key === 'linkedContainers') {
|
|
return Array.from(value);
|
|
}
|
|
|
|
return value;
|
|
};
|
|
};
|