Skip to content

Commit

Permalink
Remove bops
Browse files Browse the repository at this point in the history
  • Loading branch information
jensmtg committed Jun 23, 2022
1 parent 121992d commit d618982
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"typescript": "4.4.4"
},
"dependencies": {
"bops": "^1.0.1",
"react": "17.0",
"react-dom": "17.0"
}
Expand Down
3 changes: 1 addition & 2 deletions src/diagrams-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { DIAGRAM_VIEW_TYPE } from './constants';
import { DiagramsApp } from './DiagramsApp';
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as bops from 'bops';

export default class DiagramsView extends ItemView {
filePath: string;
Expand Down Expand Up @@ -65,7 +64,7 @@ export default class DiagramsView extends ItemView {

const saveData = (msg: any) => {
const svgData = msg.svgMsg.data
const svgBuffer = bops.from(svgData.replace('data:image/svg+xml;base64,', ''), 'base64')
const svgBuffer = Buffer.from(svgData.replace('data:image/svg+xml;base64,', ''), 'base64')
if (this.diagramExists) {
const svgFile = this.vault.getAbstractFileByPath(this.svgPath)
const xmlFile = this.vault.getAbstractFileByPath(this.xmlPath)
Expand Down
26 changes: 0 additions & 26 deletions src/useDiagramsNet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,8 @@ function useDiagramsNet(onSaveCallback, onStopEditing, getName, getData) {

/* ============== Mount and unmount ===================== */

// Mount
useEffect(() => {
// let node = document.createElement('div');
// node.setAttribute('id', frameId);
// console.log
// document.getElementById('root').appendChild(node);
}, []);

// Unmount
useEffect(() => () => {
// document.getElementById('root').removeChild(document.getElementById(frameId));
}, []);

// Save
useEffect(() => {
// console.group('save?')
// console.log('save1', save1)
// console.log('save2', save2)
// console.groupEnd()
if (save1 && save2) {
onSaveCallback({ pngMsg: save1, svgMsg: save2 })
callStopEditing();
Expand Down Expand Up @@ -135,16 +118,7 @@ function useDiagramsNet(onSaveCallback, onStopEditing, getName, getData) {
//frameRef.current.focus()
}

// function callSave(msg) {
// if (!onSaveCallback) {
// console.error('No save callback given...')
// }
// else {
// onSaveCallback(msg)
// }
// }

// eslint-disable-next-line react-hooks/exhaustive-deps
function callStopEditing() {
stopEditing()
}
Expand Down

0 comments on commit d618982

Please sign in to comment.