add function to copy a whiteboard from another one
This commit is contained in:
parent
ceedf5dfe8
commit
ed16bddd1f
@ -108,6 +108,7 @@ Call your site with GET parameters to change the WhiteboardID or the Username
|
|||||||
- username => The name which will be shown to others while drawing
|
- username => The name which will be shown to others while drawing
|
||||||
- title => Change the name of the Browser Tab
|
- title => Change the name of the Browser Tab
|
||||||
- randomid => if set to true, a random whiteboardId will be generated if not given aswell
|
- randomid => if set to true, a random whiteboardId will be generated if not given aswell
|
||||||
|
- copyfromwid => set this to a whiteboardId you want a copy from. Only copies the content if the current whiteboard is empty.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ if (urlParams.get("whiteboardid") !== whiteboardId) {
|
|||||||
|
|
||||||
const myUsername = urlParams.get("username") || "unknown" + (Math.random() + "").substring(2, 6);
|
const myUsername = urlParams.get("username") || "unknown" + (Math.random() + "").substring(2, 6);
|
||||||
const accessToken = urlParams.get("accesstoken") || "";
|
const accessToken = urlParams.get("accesstoken") || "";
|
||||||
|
const copyfromwid = urlParams.get("copyfromwid") || "";
|
||||||
|
|
||||||
// Custom Html Title
|
// Custom Html Title
|
||||||
const title = urlParams.get("title");
|
const title = urlParams.get("title");
|
||||||
@ -170,7 +171,17 @@ function initWhiteboard() {
|
|||||||
// request whiteboard from server
|
// request whiteboard from server
|
||||||
$.get(subdir + "/api/loadwhiteboard", { wid: whiteboardId, at: accessToken }).done(
|
$.get(subdir + "/api/loadwhiteboard", { wid: whiteboardId, at: accessToken }).done(
|
||||||
function (data) {
|
function (data) {
|
||||||
|
console.log(data);
|
||||||
whiteboard.loadData(data);
|
whiteboard.loadData(data);
|
||||||
|
if (copyfromwid && data.length == 0) {
|
||||||
|
//Copy from witheboard if current is empty and get parameter is given
|
||||||
|
$.get(subdir + "/api/loadwhiteboard", {
|
||||||
|
wid: copyfromwid,
|
||||||
|
at: accessToken,
|
||||||
|
}).done(function (data) {
|
||||||
|
whiteboard.loadData(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user