Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes slides width #37

Merged
merged 4 commits into from
Jul 24, 2023
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
50 changes: 50 additions & 0 deletions packages/application/src/plugins/rise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export const plugin: JupyterFrontEndPlugin<void> = {
translator: ITranslator | null,
palette: ICommandPalette | null
) => {
// Uncomment in dev mode to send logs to the parent window
//Private.setupLog();

const trans = (translator ?? nullTranslator).load('rise');

// Get the active cell index from query argument
Expand Down Expand Up @@ -1217,3 +1220,50 @@ namespace Rise {
return reveal_helpstr;
}
}

// @ts-expect-error 'Private' may never be read
namespace Private {
hbcarlos marked this conversation as resolved.
Show resolved Hide resolved
export function setupLog(): void {
const _debug = console.debug;
const _info = console.info;
const _warn = console.warn;
const _error = console.error;

function post(payload: any) {
try {
window.top?.postMessage(payload, '/');
} catch (err) {
window.top?.postMessage(
{
level: 'debug',
msg: [
'[RISE]:',
'Issue cloning object when posting log message, JSON stringify version is:',
JSON.stringify(payload)
]
},
'/'
);
}
}
console.debug = (...args) => {
post({ level: 'debug', msg: ['[RISE]:', ...args] });
_debug(...args);
};

console.info = console.info = (...args) => {
post({ level: 'info', msg: ['[RISE]:', ...args] });
_info(...args);
};

console.warn = (...args) => {
post({ level: 'warn', msg: ['[RISE]:', ...args] });
_warn(...args);
};

console.error = (...args) => {
post({ level: 'error', msg: ['[RISE]:', ...args] });
_error(...args);
};
}
}
1 change: 1 addition & 0 deletions packages/application/style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
}

.rise-enabled .reveal .slides {
width: 100% !important;
transition-property: all;
transition-duration: 0.2s;
transition-timing-function: ease;
Expand Down
30 changes: 30 additions & 0 deletions packages/lab/src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export class RisePreview extends DocumentWidget<IFrame, INotebookModel> {
]
})
});
// Uncomment in dev mode to receive logs from the iframe
//Private.setupLog();
hbcarlos marked this conversation as resolved.
Show resolved Hide resolved

this._ready = new PromiseDelegate<void>();
// `setActiveCellIndex` needs to be called at least once.
Expand Down Expand Up @@ -329,4 +331,32 @@ namespace Private {

protected input: HTMLInputElement;
}

export function setupLog(): void {
window.onmessage = (event: MessageEvent<any>) => {
//console.log("EVENT: ", event);

switch (event.data?.level) {
case 'debug':
console.debug(...(event.data?.msg ?? []));
break;

case 'info':
console.info(...(event.data?.msg ?? []));
break;

case 'warn':
console.warn(...(event.data?.msg ?? []));
break;

case 'error':
console.error(...(event.data?.msg ?? []));
break;

default:
console.log(event);
break;
}
};
}
}