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

Collaborative Whiteboard and use of Slate *everywhere* (including Jupyter markdown cells) #5674

Merged
merged 503 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
503 commits
Select commit Hold shift + click to select a range
bfdf0f6
whiteboard: render edges in share server, etc.
williamstein Feb 27, 2022
4ad6cf3
whiteboard: edge toolbar and more configurability of edges
williamstein Feb 27, 2022
e41bc04
whiteboard: fix bug with dpi and share server rendering of whiteboards
williamstein Feb 27, 2022
eb8d362
whiteboard: create object with edge by clicking on edge creation dot
williamstein Feb 28, 2022
5f7e722
whiteboard: do not draw edges between vertices that are hidden; fix b…
williamstein Feb 28, 2022
f41d200
whiteboard: using two useEffects to accomplish one task was randomly …
williamstein Feb 28, 2022
234bff1
typescript issues
williamstein Feb 28, 2022
d908d61
whiteboard: backspace or delete keyboard shortcut
williamstein Feb 28, 2022
c492ccd
Merge branch 'master' into whiteboard
williamstein Feb 28, 2022
59ada09
Merge branch 'master' into whiteboard
williamstein Feb 28, 2022
fabd255
Merge branch 'master' into whiteboard
williamstein Feb 28, 2022
c9fdd12
Merge branch 'master' into whiteboard
williamstein Feb 28, 2022
e460d78
Merge branch 'master' into whiteboard
williamstein Feb 28, 2022
3a6e7d1
Merge branch 'master' into whiteboard
williamstein Feb 28, 2022
a257a3c
Merge branch 'master' into whiteboard
williamstein Mar 1, 2022
b665cdb
Merge branch 'master' into whiteboard
williamstein Mar 1, 2022
7ff234a
whiteboard: change icon and description
williamstein Mar 1, 2022
5f154ce
Merge branch 'master' into whiteboard
williamstein Mar 1, 2022
ad515dc
Merge branch 'master' into whiteboard
williamstein Mar 1, 2022
588a83c
slate: fix more crashes
williamstein Mar 1, 2022
0c96e43
slate: upgrade to newest version of slate. This mostly works, but th…
williamstein Mar 1, 2022
73d46bf
slate upgrade: remove a bug workaround that was needed for older vers…
williamstein Mar 1, 2022
e5de42e
Merge branch 'slate-upgrade' into whiteboard
williamstein Mar 1, 2022
f63fb96
whiteboard: sending of chat in markdown mode was broken
williamstein Mar 1, 2022
f2b3ad4
jupyter slate -- fix issue with saving and debounce
williamstein Mar 1, 2022
5186933
multimode markdown: working on saving state of editors (e.g. mode and…
williamstein Mar 1, 2022
35aa2e8
markdown/slate: save selection and mode for multimode markdown editor…
williamstein Mar 2, 2022
2875b7c
whiteboard: improve icons tool panel a little.
williamstein Mar 2, 2022
3d96113
whiteboard: some code refactoring related to creating elements
williamstein Mar 2, 2022
8c69db0
whiteboard: fix bug in creating clone of object with edge
williamstein Mar 2, 2022
98619ee
whiteboard: icon sizing
williamstein Mar 2, 2022
383b0cb
whiteboard: refactoring out element spec from tool spec a little
williamstein Mar 2, 2022
047a047
whiteboard: work in progress messing with pinch to zoom, etc., -- cur…
williamstein Mar 3, 2022
86df333
whiteboard: pinch to zoom -- also work on windows... but I think I ju…
williamstein Mar 3, 2022
75dce80
whiteboard: properly use the useWheel gesture library functionality, …
williamstein Mar 3, 2022
ca23758
whiteboard: working on making zoom more fluid...
williamstein Mar 3, 2022
6f4ddfc
whiteboard: broken difficult work in progress revamp of zoom/scroll/p…
williamstein Mar 3, 2022
f05cb78
whiteboard: reimplemneting mouse wheel pan
williamstein Mar 3, 2022
8ca6055
whiteboard canvas -- get rid of all use of scrollTop/scrollLeft -- no…
williamstein Mar 3, 2022
37e4db2
whiteboard: basics of the new pinch/zoom/pan model. It works, but ev…
williamstein Mar 3, 2022
2563b77
whiteboard: add a little bit of animation and throttling to pinch-to-…
williamstein Mar 3, 2022
83f53bb
whiteboard: working on redoing how scale works.
williamstein Mar 4, 2022
9e14d5b
whiteboard: working on new pan/zoom/pinch model
williamstein Mar 4, 2022
d2a5407
whiteboards: fix issue with clicking on nav map
williamstein Mar 4, 2022
a798039
whiteboard: prevent scrolling off screen
williamstein Mar 4, 2022
e7bcf6d
whiteboard: preserve screen setting when zooming with buttons or keyb…
williamstein Mar 4, 2022
f74ef09
Merge branch 'master' into whiteboard
williamstein Mar 4, 2022
58cf0ca
tasks: do not stop editing on blue in general -- need better strategy
williamstein Mar 4, 2022
a413a44
slate/markdown: work in progress implementing undo/redo/save support
williamstein Mar 4, 2022
c9c10e3
multimode markdown input: edit save debounce for codemirror
williamstein Mar 4, 2022
36a63e0
whiteboard: better control of whiteboard zoom range; rewrite fit to s…
williamstein Mar 4, 2022
e28c405
whiteboard: zooming and center robust now
williamstein Mar 4, 2022
f5a0365
whiteboard: adding new objects causes a jump / move
williamstein Mar 4, 2022
9524e96
whiteboard: pinch-to-zoom - start with the correct zoom level
williamstein Mar 4, 2022
d00b2ee
whiteboard: fix inevitable bug with transforms/closures/references
williamstein Mar 4, 2022
2b0e41e
whiteboard: rewrite the pen canvas preview to just use a canvas over …
williamstein Mar 5, 2022
403aec8
whiteboard: implement more efficient pen drawing preview
williamstein Mar 5, 2022
0693cfa
whiteboard: trivial jupyter code cell pallete
williamstein Mar 5, 2022
32a985e
whiteboard/sync: use debouncing to massively speed up doing a large n…
williamstein Mar 5, 2022
6425d8c
fix new bug of missing key for projects page footer. weird.
williamstein Mar 6, 2022
b86a396
whiteboard: fix issue with canvas being positioned wrong when hiding …
williamstein Mar 6, 2022
7efe88c
whiteboard: fix bug involving canvas jumping when new objects added
williamstein Mar 6, 2022
affe4e9
whiteboard: discard a few points that are "pointless"...
williamstein Mar 6, 2022
492c2f7
slate: wrap many errors in warnings for now.
williamstein Mar 6, 2022
34f66f1
slate: rewrite upload hook to not require saving anything on editor, …
williamstein Mar 6, 2022
71aa1bf
slate: don't save search data on editor object, so it can be JSON'd.
williamstein Mar 6, 2022
c78ddf9
slate: use more scoped window list ref; with this change the slate ed…
williamstein Mar 6, 2022
566f1cf
slate: working on ensuring markdown to slate is normalized properly
williamstein Mar 6, 2022
729a301
slate: fix a number of cases in which markdown-to-slate isn't properl…
williamstein Mar 6, 2022
dc03ed7
slate: figured out how to efficiently normalize, and now doing that a…
williamstein Mar 6, 2022
494815e
Merge branch 'master' into whiteboard
williamstein Mar 6, 2022
28221a5
slate: rewrite the 3-way merge approach for our full slate markdown e…
williamstein Mar 7, 2022
2f8e071
slate: fix issue with collaborative editing and line ending in a sing…
williamstein Mar 7, 2022
ff3cbf8
Merge branch 'whiteboard' of github.com:sagemathinc/cocalc into white…
williamstein Mar 7, 2022
3231f5a
slate: actually fully implement the strategy of recording what markdo…
williamstein Mar 8, 2022
689b25a
re: previous -- don't delete trailing whitespace
williamstein Mar 8, 2022
cf7d813
slate: single item list reverted to not tight due to normalize...
williamstein Mar 8, 2022
2f6adce
slate: more (all?) retension of source markdown; fix issue with parag…
williamstein Mar 8, 2022
9e6c9ee
unused
williamstein Mar 8, 2022
b2ccfcb
this emit change I added for some reason I forget related to the whit…
williamstein Mar 8, 2022
5f34a10
Merge branch 'master' into whiteboard
williamstein Mar 8, 2022
6c68084
improve an error message; also one function is not actually async
williamstein Mar 8, 2022
1eb0e13
slate: fix incredibly annoying bug when immediately typing text in bo…
williamstein Mar 8, 2022
c64dcca
slate: fix very annoying bug with moving cursor out of codemirror edi…
williamstein Mar 8, 2022
efd94ad
slate: automatically normalize away links with empty text
williamstein Mar 8, 2022
b70dff5
slate: not good partial fix for math formulas inside code blocks. Ba…
williamstein Mar 8, 2022
68a4f7d
board: fix fit to zoom and also fix border color of emoji
williamstein Mar 9, 2022
4a1fcc7
subtle sync issue part 2 -- fixed I hope, with better comments
williamstein Mar 9, 2022
2e738d9
markdown/slate: working on variable height editor
williamstein Mar 9, 2022
2a94a51
whiteboard: improve automatic height determination strategy for notes…
williamstein Mar 9, 2022
ed9d9b8
fix some style issues with slate and non-white background
williamstein Mar 9, 2022
a0be2e2
whiteboard: fix some issues with opening and restoring scroll position
williamstein Mar 9, 2022
e9d4860
add cursor support for multimode editor used for editing markdown cel…
williamstein Mar 9, 2022
05214a7
cursors: implement for codemirror mode of multimode editor; also fix …
williamstein Mar 10, 2022
7cfbafa
cursors: fix some situations where cursor state was discarded, but it…
williamstein Mar 10, 2022
090883a
Merge branch 'master' into whiteboard
williamstein Mar 11, 2022
18f76a0
get rid of the 4131 fix; this problem doesn't happen with the latest …
williamstein Mar 11, 2022
0c1e823
Merge branch 'master' into whiteboard
williamstein Mar 11, 2022
0e3287a
multimode editor: support detecting cursor up at top and cursor down …
williamstein Mar 11, 2022
e90f33f
slate jupyter integration -- implement focus/blur control
williamstein Mar 11, 2022
afa558b
slate/codemirror multimode editor -- implemented support for external…
williamstein Mar 12, 2022
143d814
variable height editor for tasks and editing past chat
williamstein Mar 12, 2022
6a9af99
tasks: fix scrolling into view
williamstein Mar 12, 2022
4a51f6c
task-related polish; ensure source multimode label doesn't overlap in…
williamstein Mar 12, 2022
949cf82
multimode: just messing around
williamstein Mar 12, 2022
71b8d17
whiteboard: tweak some styles
williamstein Mar 13, 2022
7d12d69
fix bug with autofocus and slate
williamstein Mar 13, 2022
e07bcd7
tasks: make it so only one editor can be opened at a time.
williamstein Mar 13, 2022
f2c69a5
board: two clicks to focus note; also don't break when opening board …
williamstein Mar 13, 2022
a60a298
slate: fix hashtags when background is dark and font color is white
williamstein Mar 13, 2022
364ffce
slate: greatly improve math autoformatting with a small change; now y…
williamstein Mar 13, 2022
e85e3fa
added ability to set the color of tasks; might as well!
williamstein Mar 13, 2022
44144d8
with colors we need a stronger "border left".
williamstein Mar 13, 2022
0e21043
whiteboard tool panel: fix a few tiny bugs
williamstein Mar 13, 2022
a1d538f
editing markdown: placeholder text and focus control
williamstein Mar 13, 2022
9b0ad25
whiteboard code -- first approach to controlling focus of input prope…
williamstein Mar 13, 2022
6a856d7
whiteboard, etc.: codemirror versus scaling and rotation
williamstein Mar 13, 2022
5e94796
tasks: make color selector much more usable via a toggle
williamstein Mar 13, 2022
b48e856
slight tweak to tasks border
williamstein Mar 13, 2022
50a6a1e
task list - fix slight style issue with color
williamstein Mar 13, 2022
a65aa85
whiteboard: cursors for code cells
williamstein Mar 13, 2022
d2f24e6
whiteboard: make it so cursors fully work for text/notes, even when t…
williamstein Mar 14, 2022
e776d25
whiteboard: make it possible to check checkboxes, etc.
williamstein Mar 14, 2022
e56496f
jupyter: fix so cursors work again.
williamstein Mar 14, 2022
9dfb57b
whiteboard: better style; also fix bug with selecting text with slate…
williamstein Mar 14, 2022
9ca2e76
whiteboard: escape to stop editing text; escape again to deselect.
williamstein Mar 14, 2022
02ee56d
whiteboard: implement editFocus for code cells
williamstein Mar 14, 2022
4bf2015
tasks: move done checkbox back to the left
williamstein Mar 15, 2022
d87d75f
markdown multimode -- use radio buttons
williamstein Mar 15, 2022
d421d82
switch to using a proper markdown-it plugin for handling math! Final…
williamstein Mar 16, 2022
9b37f00
Merge branch 'master' into whiteboard
williamstein Mar 16, 2022
6a006e4
markdown + slate + math -- support more edge cases properly
williamstein Mar 16, 2022
8070898
slightly better pinch-to-zoom params
williamstein Mar 16, 2022
32c4463
whiteboard: refactor editFocus code across components that use it.
williamstein Mar 17, 2022
91ae589
whiteboard chat: save message that is being composed
williamstein Mar 17, 2022
48e3964
chat: render information about other users composing a message.
williamstein Mar 17, 2022
03ffdb1
chat: make it so undo/redo works
williamstein Mar 17, 2022
4dfd0fe
chat: make the edit bar fully visible.
williamstein Mar 17, 2022
0c8f4b2
slate: address a crash I saw
williamstein Mar 17, 2022
0fa31fe
fix a markdown-it math error
williamstein Mar 17, 2022
65d2460
markdown multimode toggle switch: fix annoying style issue
williamstein Mar 17, 2022
4cc0b64
whiteboard: scroll on any target except canvas for now.
williamstein Mar 17, 2022
77109d9
slate: address a case where cursor can't be restored
williamstein Mar 17, 2022
8e19447
whiteboard: improve cursor
williamstein Mar 17, 2022
df258a9
whiteboard: fix text/note undo/redo
williamstein Mar 17, 2022
3ff3440
whiteboard: fix text/note undo/redo
williamstein Mar 17, 2022
ff9a5f7
Merge branch 'whiteboard' of github.com:sagemathinc/cocalc into white…
williamstein Mar 17, 2022
26c7194
whiteboard: refactor and improve (for touch) handling of code for sel…
williamstein Mar 17, 2022
6f64e27
whiteboard: move tool configuration to account editor_settings
williamstein Mar 18, 2022
03e0f6a
whiteboard: use green border (same as Jupyter) when focused and editi…
williamstein Mar 19, 2022
e3a43b9
whiteboard: make the hand tool work on ipad/touch
williamstein Mar 19, 2022
fe2954a
ipad -- major fix regarding vertical size and scroll.
williamstein Mar 19, 2022
37903c0
slate: re-enable some amount of scollIntoView; definitely not optimal…
williamstein Mar 19, 2022
46aa017
multimode + touch -- disable placeholder for slate, since it blocks s…
williamstein Mar 19, 2022
e89dcb1
whiteboard: enter to edit selected thing
williamstein Mar 19, 2022
b1c8b04
whitebaord: disable SELECTED_PADDING, since it's not quite working
williamstein Mar 19, 2022
b7a3f4c
whiteboard: re-enable / fix copy/paste
williamstein Mar 19, 2022
f5766bd
whiteboard: only prevent scrolling canvas when over selected element,…
williamstein Mar 19, 2022
03efff9
whiteboard: arrow keys
williamstein Mar 19, 2022
52f5195
whiteboard: ensure id's are unique; also make copy/paste include edges
williamstein Mar 19, 2022
4f013b0
whiteboard: fix bugs related to where elements are pasted
williamstein Mar 19, 2022
e930414
whiteboard: make the edge creation tool very slightly more usable
williamstein Mar 20, 2022
08a9c92
whiteboard: fix bugs with copy/paste and edges
williamstein Mar 20, 2022
140b0f0
whiteboard: implement hopefully actually usable edge creation.
williamstein Mar 20, 2022
66253f1
whiteboard/touch: fix issues with focus
williamstein Mar 20, 2022
b1b1b5f
whiteboard: fix more issues with touch devices, zooming, and panning.…
williamstein Mar 20, 2022
ac08991
fix issue with input state and running code
williamstein Mar 20, 2022
3f6d6cf
whiteboard: starting work on jupyter control
williamstein Mar 21, 2022
9dd1392
whiteboard: fix a little jupyter focus issue
williamstein Mar 21, 2022
34045bc
slate: disable incorrect scroll
williamstein Mar 21, 2022
4cf10a1
slate: fix major bug in saving value when no codemirror editor opened…
williamstein Mar 22, 2022
42aab07
slate: change an error to a warning regarding insertText
williamstein Mar 22, 2022
d0eb584
always exit undo mode if explicitly asked to do so and set_value is c…
williamstein Mar 25, 2022
91d8652
slate: improvements related to collaborative editing -- in particular…
williamstein Mar 26, 2022
a9a8fb3
Merge branch 'master' into whiteboard
williamstein Mar 26, 2022
3b69b97
slate: reintroduce code for maintaining one trailing whitespace, sinc…
williamstein Mar 26, 2022
fe88c90
slate: improve how hasUnsavedChanges works. also get rid of triming t…
williamstein Mar 26, 2022
641e2dd
slate: disable force option to normalize when translating to slate, s…
williamstein Mar 26, 2022
035e26d
slate: make preserving one whitespace character better.
williamstein Mar 26, 2022
e27a6a6
slate: more aggressive escaping of markdown, which is needed for coll…
williamstein Mar 26, 2022
454d6fd
slate: fix issue with new unsaved changes tracking
williamstein Mar 26, 2022
ff41d07
sync: make a possibly crazy and dangerous change to the core sync alg…
williamstein Mar 26, 2022
15b61cb
make cursor slightly better (at least on chrome)
williamstein Mar 26, 2022
d7c4ebf
slate: massive optimization for opening large documents (and also jus…
williamstein Mar 26, 2022
dff3a46
slate: fix subtle bug in caching (never live in production)
williamstein Mar 26, 2022
32e31ec
fix regexp compat issue with safari
williamstein Mar 27, 2022
381f94e
slate: work in progress in switching from react-window to virtuoso. …
williamstein Mar 27, 2022
41314ee
slate with windowing -- make it possible to navigate up/down using th…
williamstein Mar 27, 2022
09b4f1b
slate: oh joyous day! I finally figured out why non-windowed slate w…
williamstein Mar 27, 2022
c3a9a66
slate: implement delayed rendering, but disabled since not really wor…
williamstein Mar 28, 2022
988abaf
slate: improve implementing delayed rendering; revert some context st…
williamstein Mar 28, 2022
d24325b
slate: removed the delayed rendering code -- it messes up the selecti…
williamstein Mar 28, 2022
f21e9a8
slate: back to windowing -- it's just insanely hard trying to optimiz…
williamstein Mar 28, 2022
200be7e
slate: get rid of redundant/wrong focus state tracking, which was bre…
williamstein Mar 28, 2022
7226578
slate: fix bug with generating tight lights and caching
williamstein Mar 28, 2022
bf6cc67
sync: fix little bug I recently introduced (not in production) in undo
williamstein Mar 28, 2022
db4e783
slate: fix issue with multiple editors and not cleaning up syncstring…
williamstein Mar 28, 2022
f5a60a6
Merge branch 'master' into whiteboard
williamstein Mar 28, 2022
90cd0b0
slate: implementing scroll offset preservation for windowing, so mult…
williamstein Mar 29, 2022
bf94a7a
slate: finish implementing preservation of scroll position properly w…
williamstein Mar 29, 2022
3be2fd5
slate: finish scroll preservation and implement new scroll into view …
williamstein Mar 29, 2022
8c0060c
slate: restore scroll state -- make work with windowing
williamstein Mar 29, 2022
4fb9d47
slate: fix issue with splitting frame and scrolling
williamstein Mar 29, 2022
ce4b1c0
slate: instead of preserving top row when windowing, preserve second …
williamstein Mar 29, 2022
6afea4e
slate: re-implement scrollIntoDOM; make scroll tracking code for wind…
williamstein Mar 29, 2022
ebec914
slate: windowing + selection -- part 1: preserve it. shift+click not…
williamstein Mar 29, 2022
548ffc7
slate: windowing + selection works now robustly and on chrome+safari+…
williamstein Mar 29, 2022
e8733f9
slate: fixed scroll preservation
williamstein Mar 29, 2022
22bc541
slate: re-implement scroll cursor into view on move for windowing
williamstein Mar 29, 2022
01c38cf
slate: modify sync map from slate to markdown positions to work with …
williamstein Mar 29, 2022
25980e3
slate: implement page up/down and beginning/end of document shortcuts…
williamstein Mar 29, 2022
1f1203f
pinch to zoom (whiteboard): disable stuck "overzoom"
williamstein Mar 29, 2022
636116d
multimode markdown editing and whiteboard: steps toward correctly imp…
williamstein Mar 30, 2022
7b64c8e
multimode markdown: implement getValueRef also for codemirror
williamstein Mar 30, 2022
879a09c
whiteboard: fix issue with scope of wheel panning and focused elements
williamstein Mar 30, 2022
1e2df78
update chat/tasks/jupyter to use new multimode before-change hook
williamstein Mar 30, 2022
ce23ddf
slate: fix bug with caching versus editing tables
williamstein Mar 30, 2022
466cdf5
Merge branch 'master' into whiteboard
williamstein Mar 30, 2022
019ca77
slate: fix issue with pasting groups (remap them)
williamstein Mar 30, 2022
f02ee4e
whiteboard: fix bug when clicking on navmap
williamstein Mar 30, 2022
038733d
whiteboard: s shortcut for stopwatch; also ignore frame when making a…
williamstein Mar 30, 2022
bf23557
add a comment about gesture events being safari only
williamstein Mar 30, 2022
fbe58de
whiteboard: note preview -- fix padding
williamstein Mar 30, 2022
583653a
whiteboard: fix heading font color to match global color (undoing ant…
williamstein Mar 30, 2022
3606479
fix another markdown-with-dark-background style issue
williamstein Mar 31, 2022
8cb3bb1
board: fix major confusing cursor issue
williamstein Mar 31, 2022
48d9422
raise profile of Markdown a little in +new page.
williamstein Mar 31, 2022
ed16ddd
Merge branch 'master' into whiteboard
williamstein Mar 31, 2022
7b3bb88
Merge branch 'whiteboard' of github.com:sagemathinc/cocalc into white…
williamstein Mar 31, 2022
b6fe4d3
numerous math and markdown related fixes I found by testing a complic…
williamstein Mar 31, 2022
c03de60
Merge branch 'master' into whiteboard
williamstein Apr 1, 2022
446b4fa
Merge branch 'whiteboard' of github.com:sagemathinc/cocalc into white…
williamstein Apr 1, 2022
59c05ed
whiteboard: button to open corresponding jupyter notebook
williamstein Apr 1, 2022
f2a00f1
jupyter: refactor the kernel selection code to not pass state down fo…
williamstein Apr 1, 2022
29650a8
whiteboard: select jupyter kernel
williamstein Apr 2, 2022
a109379
whiteboard: move size to a function in the spec for initial creation …
williamstein Apr 2, 2022
fe480bc
whiteboard: factor out "select" into tool spec
williamstein Apr 2, 2022
e6522da
whiteboard: some syntax highlighting based on kernel (this is really …
williamstein Apr 2, 2022
cf256d2
whiteboard: show jupyter context panel when any jupyter cell is in th…
williamstein Apr 2, 2022
66383dd
jupyter: add interrupt and halt actions to kernel status bar (so can …
williamstein Apr 3, 2022
345774b
jupyter: add confirmation for halt of kernel
williamstein Apr 3, 2022
12f25e6
jupyter: factor out the kernel usage code into a separate hook (much …
williamstein Apr 3, 2022
2015b1d
whiteboard chat: fix issue with clearing chat state.
williamstein Apr 3, 2022
13b9e18
whiteboard: prevent wheel nav when mouse over a chat, so you can scro…
williamstein Apr 3, 2022
4340796
whiteboard chat: make it possible to scroll through past chats
williamstein Apr 3, 2022
1be92ea
whiteboard: improve style of the jupyter control panel
williamstein Apr 3, 2022
7a1ebd8
whiteboard: jupyter code cell input prompt
williamstein Apr 3, 2022
04c313d
whiteboard: ability to interrupt running computation (now in three di…
williamstein Apr 3, 2022
55284ee
whiteboard: improve scrolling
williamstein Apr 4, 2022
1705eb3
whiteboard: code resize, duplicate button, icons for actions menu
williamstein Apr 4, 2022
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
24 changes: 22 additions & 2 deletions src/packages/frontend/_editor.sass
Original file line number Diff line number Diff line change
Expand Up @@ -614,22 +614,33 @@ code
margin-right : -5px

/* IMPORTANT FOR SAGE WORKSHEETS! Do not remove!
This is for the hi font-size's below!
We override the bootstrap css styles, which hardcode a specific
pixel font-size for headers, and hence can't be zoomed.
See https://github.com/sagemathinc/cocalc/issues/585 */
See https://github.com/sagemathinc/cocalc/issues/585

And the color:inherit is because antd sets the color to black-ish,
which is very annoying if we have a dark background and want
color white uniformly, e.g., on sticky notes. */

h1
font-size: 250%
color: inherit
h2
font-size: 200%
color: inherit
h3
font-size: 170%
color: inherit
h4
font-size: 150%
color: inherit
h5
font-size: 130%
color: inherit
h6
font-size: 110%
color: inherit

/* Important: for display math in Sage Worksheets.
See https://github.com/sagemathinc/cocalc/issues/136
Expand Down Expand Up @@ -723,4 +734,13 @@ h6
font-size: inherit
pre
font-size: inherit
padding: 5px
padding: 5px

.cocalc-whiteboard-edge-select
&:hover
border: 2.5px solid #ccc
margin: -2.5px

.cocalc-whiteboard-edge-selected
border: 2.5px solid #ccc
margin: -2.5px
14 changes: 11 additions & 3 deletions src/packages/frontend/account/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export const Avatar: React.FC<Props> = (props) => {
// we use the user_map to display the username and face:
const user_map = useTypedRedux("users", "user_map");
const [image, set_image] = useState<string | undefined>(undefined);
const [background_color, set_background_color] = useState<string>(
DEFAULT_COLOR
);
const [background_color, set_background_color] =
useState<string>(DEFAULT_COLOR);

useAsyncEffect(
async (isMounted) => {
Expand Down Expand Up @@ -95,6 +94,15 @@ export const Avatar: React.FC<Props> = (props) => {
redux.getProjectActions(project_id).open_file({ path });
return;
case "file":
const actions = redux.getEditorActions(project_id, path);
const gotoUser = actions["gotoUser"];
if (gotoUser != null) {
// This is at least implemented for the whiteboard (which doesn't
// have a good notion of lines), but should be done more
// generally, replacing the stuff below about cursor_line...
gotoUser(props.account_id);
return;
}
var line = get_cursor_line();
if (line != null) {
redux.getProjectActions(project_id).goto_line(path, line);
Expand Down
14 changes: 5 additions & 9 deletions src/packages/frontend/account/avatar/font-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ import onecolor from "onecolor";

export function avatar_fontcolor(bg): "white" | "black" {
const col_bg = onecolor(bg);
// col_bg === false happens when for unknown reasons (maybe output produced by an old buggy version of a library?),
// the color in the profile is invalid -- {"color": "rgb(255,-8,0)", "image": ""}.
if (col_bg === false) {
return "white";
if (!col_bg) {
return "black";
}
if (
((typeof col_bg?.magenta === "function" && col_bg.magenta()) || 0) >= 0.4
) {
return "white";
} else {
if (col_bg.lightness() > 0.5) {
return "black";
} else {
return "white";
}
}
5 changes: 3 additions & 2 deletions src/packages/frontend/app-framework/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ import useToggle from "./toggle-hook";
export { useToggle };

export function useForceUpdate() {
const [state, set_state] = useState<boolean>(true);
const counterRef = useRef<any>(0);
const [, setCounter] = useState<number>(0);
return () => {
set_state(!state);
setCounter((counterRef.current += 1));
};
}

Expand Down
15 changes: 14 additions & 1 deletion src/packages/frontend/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare var DEBUG: boolean;
import { ProjectsNav } from "../projects/projects-nav";

import { COLORS } from "@cocalc/util/theme";
import { IS_SAFARI, IS_MOBILE, IS_IOS } from "../feature";

import { Button, Navbar, Nav } from "../antd-bootstrap";
import {
Expand Down Expand Up @@ -77,7 +78,19 @@ const PROJECTS_STYLE: React.CSSProperties = {
padding: "10px 7px",
} as const;

let page_height: string = "100vh";
// ipad and ios have a weird trick where they make the screen
// actually smaller than 100vh and have it be scrollable, even
// when overflow:hidden, which causes massive UI pain to cocalc.
// so in that case we make the page_height less. Without this
// one little tricky, cocalc is very, very frustrating to use
// on mobile safari. See the million discussions over the years:
// https://liuhao.im/english/2015/05/29/ios-safari-window-height.html
// ...
// https://lukechannings.com/blog/2021-06-09-does-safari-15-fix-the-vh-bug/
let page_height: string =
IS_MOBILE || IS_SAFARI
? `calc(100vh - env(safe-area-inset-bottom) - ${IS_IOS ? 80 : 20}px)`
: "100vh";

const PAGE_STYLE: React.CSSProperties = {
display: "flex",
Expand Down
4 changes: 3 additions & 1 deletion src/packages/frontend/chat/chat-log.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export const ChatLog: React.FC<ChatLogProps> = React.memo(
}
include_avatar_col={show_heads}
get_user_name={(account_id) => get_user_name(user_map, account_id)}
scroll_into_view={() => windowed_list_ref?.current?.scrollToRow(i)}
scroll_into_view={() =>
windowed_list_ref?.current?.scrollToRow(i, "top")
}
/>
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/packages/frontend/chat/chatroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,6 @@ export const ChatRoom: React.FC<Props> = ({ project_id, path }) => {
}}
>
<ChatInput
project_id={project_id}
path={path}
input={input}
on_send={on_send}
height={INPUT_HEIGHT}
Expand Down
33 changes: 22 additions & 11 deletions src/packages/frontend/chat/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,37 @@
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/

import { useActions, useRedux } from "../app-framework";
import { MarkdownInput } from "../editors/markdown-input";
import { CSSProperties } from "react";
import { useRedux } from "../app-framework";
import MarkdownInput from "@cocalc/frontend/editors/markdown-input/multimode";
import { IS_MOBILE } from "../feature";
import { useFrameContext } from "../frame-editors/frame-tree/frame-context";

interface Props {
project_id: string;
path: string;
input: string;
input?: string;
on_paste?: (e) => void;
on_send: () => void;
on_send?: (value: string) => void;
height?: string;
onChange: (string) => void;
submitMentionsRef: any;
submitMentionsRef?: any;
font_size?: number;
hideHelp?: boolean;
style?: CSSProperties;
cacheId?: string;
onFocus?: () => void;
onBlur?: () => void;
}

export const ChatInput: React.FC<Props> = (props) => {
const actions = useActions(props.project_id, props.path);
const font_size = useRedux(["font_size"], props.project_id, props.path);
const { project_id, path, actions } = useFrameContext();
const font_size =
props.font_size ?? useRedux(["font_size"], project_id, path);
return (
<MarkdownInput
project_id={props.project_id}
path={props.path}
saveDebounceMs={0}
onFocus={props.onFocus}
onBlur={props.onBlur}
cacheId={props.cacheId}
value={props.input}
enableUpload={true}
onUploadStart={() => actions?.set_uploading(true)}
Expand All @@ -42,7 +51,9 @@ export const ChatInput: React.FC<Props> = (props) => {
}
fontSize={font_size}
lineWrapping={true}
hideHelp={props.hideHelp}
autoFocus
style={props.style}
/>
);
};
30 changes: 15 additions & 15 deletions src/packages/frontend/chat/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
message_colors,
newest_content,
sender_is_viewer,
INPUT_HEIGHT,
} from "./utils";
import { Markdown } from "./markdown";

Expand Down Expand Up @@ -78,14 +77,15 @@ export const Message: React.FC<Props> = React.memo((props) => {
[props.message] /* note -- edited_message is a function of props.message */
);

const history_size = useMemo(() => props.message.get("history").size, [
props.message,
]);
const history_size = useMemo(
() => props.message.get("history").size,
[props.message]
);

const isEditing = useMemo(() => is_editing(props.message, props.account_id), [
props.message,
props.account_id,
]);
const isEditing = useMemo(
() => is_editing(props.message, props.account_id),
[props.message, props.account_id]
);

const editor_name = useMemo(() => {
return props.get_user_name(
Expand Down Expand Up @@ -211,8 +211,8 @@ export const Message: React.FC<Props> = React.memo((props) => {
// no editing functionality of not in a project with a path.
return;
}
props.scroll_into_view();
props.actions.set_editing(props.message, true);
props.scroll_into_view();
}

function avatar_column() {
Expand Down Expand Up @@ -297,9 +297,11 @@ export const Message: React.FC<Props> = React.memo((props) => {
className="smc-chat-message"
onDoubleClick={edit_message}
>
<span style={lighten}>
<Time message={props.message} edit={edit_message} />
</span>
{!isEditing && (
<span style={lighten}>
<Time message={props.message} edit={edit_message} />
</span>
)}
{!isEditing ? (
<Markdown
value={value}
Expand Down Expand Up @@ -360,12 +362,10 @@ export const Message: React.FC<Props> = React.memo((props) => {
}
return (
<ChatInput
project_id={props.project_id}
path={props.path}
input={edited_message}
submitMentionsRef={submitMentionsRef}
on_send={on_send}
height={INPUT_HEIGHT}
height={"auto"}
onChange={(value) => {
edited_message_ref.current = value;
set_edited_message(value);
Expand Down
7 changes: 1 addition & 6 deletions src/packages/frontend/chat/side-chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,12 @@ export const SideChat: React.FC<Props> = ({ project_id, path }: Props) => {
style={{
marginTop: "auto",
padding: "5px",
paddingLeft: "15px",
paddingRight: "15px",
display: "flex",
flexDirection: "column",
}}
>
<div style={{ display: "flex", flex: 1 }}>
<ChatInput
project_id={project_id}
path={path}
input={input}
on_send={() => {
send_chat();
Expand All @@ -216,9 +212,8 @@ export const SideChat: React.FC<Props> = ({ project_id, path }: Props) => {
width: INPUT_HEIGHT /* yes, to make it square */,
}}
>
<div style={{ flex: 1 }} />
<Button
style={{ height: INPUT_HEIGHT }}
style={{ flex: 1, marginLeft: "5px" }}
onClick={() => {
send_chat();
user_activity("side_chat", "send_chat", "click");
Expand Down
2 changes: 1 addition & 1 deletion src/packages/frontend/chat/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { redux } from "../app-framework";
import { MentionList } from "./store";
import { Message } from "./types";

export const INPUT_HEIGHT = "100px";
export const INPUT_HEIGHT = "130px";

export const USER_MENTION_MARKUP =
'<span class="user-mention" account-id=__id__ >@__display__</span>';
Expand Down
Loading