Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/include/ipebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ class Stream {
Stream & operator<<(double d);
void putHexByte(char b);
void putXmlString(String s);
void putJsonString(String s);
};

/*! \class ipe::TellStream
Expand Down
3 changes: 2 additions & 1 deletion src/include/ipeutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ class A85Stream : public Stream {

class Base64Stream : public Stream {
public:
Base64Stream(Stream & stream);
Base64Stream(Stream & stream, bool noLineBreaks = false);
virtual void putChar(char ch);
virtual void close();

private:
Stream & iStream;
uint8_t iCh[3];
int iNoLineBreaks;
int iN;
int iCol;
};
Expand Down
5 changes: 3 additions & 2 deletions src/ipe-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ <h3 id="modal-header-content"></h3>
<div id="filedialog-label">Enter filename</div>
<input id="filename" />
<div id="directory"></div>
<div id="filedialog-error">The filename must not contain a slash (<tt>/</tt>) and must have
one of the following extensions: <tt>ipe pdf isy png jpg svg lua</tt></div>
<div id="filedialog-error">The filename must not contain a
slash (<tt>/</tt>) and must have one of the following extensions:
<tt>ipe pdf isy png jpg svg lua pptx</tt></div>
<div id="filedialog-upload">
Or upload a file:
<input id="upload" type="file" />
Expand Down
4 changes: 3 additions & 1 deletion src/ipe-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
},
"dependencies": {
"@melloware/coloris": "^0.24.0",
"sortablejs": "^1.15.3"
"sortablejs": "^1.15.3",
"jszip": "^3.10.2",
"pptxgenjs": "^4.0.1"
}
}
136 changes: 134 additions & 2 deletions src/ipe-web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions src/ipe-web/src/ipe/ipeui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export class IpeUi {
externalConfiguration = "";
private internalConfiguration = "";
private _presentationWindow: Window | null = null;
_createSlides:
| ((
jsonData: string,
textConversion: string,
titleConversion: string,
) => Promise<Uint8Array>)
| null = null;

constructor(
ipe: Ipe,
Expand Down Expand Up @@ -708,6 +715,7 @@ export class IpeUi {
"tablet_hints",
"undo",
"redo",
"export_pptx",
].includes(name)
)
return;
Expand Down Expand Up @@ -1247,4 +1255,24 @@ export class IpeUi {
}
}
}

async createSlides(
jsonFn: string,
outFn: string,
textConversion: string,
titleConversion: string,
): Promise<void> {
if (this._createSlides) {
const jsonData = window.ipeui.ipe.FS.readFile(jsonFn, {
encoding: "utf8",
});
const data = await this._createSlides(
jsonData,
textConversion,
titleConversion,
);
window.ipeui.ipe.FS.writeFile(outFn, data);
window.ipeui.modal.fileManager();
}
}
}
16 changes: 14 additions & 2 deletions src/ipe-web/src/ipe/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import "./modal.css";
import Sortable from "sortablejs";
import type { PopupMenu, PopupMenuResults } from "./popup-menu";

type Directory = "documents" | "images" | "styles" | "ipelets";
type Directory =
| "documents"
| "images"
| "styles"
| "ipelets"
| "presentations";

interface FileType {
dir: Directory;
Expand All @@ -30,6 +35,12 @@ const knownFileTypes: { [ext: string]: FileType } = {
svg: { dir: "images", mimeType: "image/svg+xml" },
isy: { dir: "styles", mimeType: "application/xml" },
lua: { dir: "ipelets", mimeType: "text/plain" },
html: { dir: "presentations", mimeType: "text/html" },
pptx: {
dir: "presentations",
mimeType:
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
},
};

type ResumeCallback = (result: ResumeResult, threadRef: number) => void;
Expand Down Expand Up @@ -58,8 +69,9 @@ export interface PageSelectorItem {
function dirFromOptions(options: FileDialogOptions): Directory {
const f = options.filters[0];
if (f.includes("*.ipe")) return "documents";
if (f.includes("*.isy")) return "styles";
if (f.includes("*.isy") || f === "reveal.htmljs") return "styles";
if (f.includes("*.lua")) return "ipelets";
if (f.includes("*.html") || f.includes("*.pptx")) return "presentations";
return "images";
}

Expand Down
Loading
Loading