Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Notebook
Commits
21be7375
Commit
21be7375
authored
Oct 29, 2020
by
Romain Casati
Browse files
Sharing function goes from notebook to GUI.
parent
d8426ee3
Changes
3
Hide whitespace changes
Inline
Side-by-side
notebook/basthon/gui.js
View file @
21be7375
...
...
@@ -17,6 +17,9 @@ window.basthonGUI = (function () {
if
(
!
that
.
notebook
)
{
location
.
reload
();
}
// keeping back dialog module from notebook.
that
.
dialog
=
that
.
notebook
.
dialog
;
/*
loading content from query string or from local storage.
...
...
@@ -38,6 +41,38 @@ window.basthonGUI = (function () {
event
,
()
=>
{
that
.
notebook
.
saveToStorage
();
}
);
}
};
/**
* Sharing notebook via URL.
*/
that
.
share
=
function
(
key
=
"
ipynb
"
)
{
const
msg
=
$
(
"
<div>
"
).
html
(
`
<p>
<i class="fa fa-copy"></i>
Un lien vers la page de Basthon avec le contenu actuel du notebook
a été copié dans le presse-papier.
<p>
Vous pouvez le coller où vous voulez pour partager votre notebook.
<p>
<i class="fa fa-exclamation-circle"></i>
Attention, partager un notebook de taille trop importante peut ne
pas fonctionner avec certains navigateurs.
`
);
that
.
notebook
.
events
.
trigger
(
'
before_share.Notebook
'
);
that
.
notebook
.
_copyContentAsURL
(
key
);
that
.
dialog
.
modal
({
notebook
:
that
.
notebook
,
keyboard_manager
:
that
.
notebook
.
keyboard_manager
,
title
:
i18n
.
msg
.
_
(
"
Un lien vers ce notebook a été copié
"
),
body
:
msg
,
buttons
:
{
OK
:
{
"
class
"
:
"
btn-primary
"
}
}
});
that
.
notebook
.
events
.
trigger
(
'
notebook_shared.Notebook
'
);
};
return
that
;
})();
...
...
notebook/static/notebook/js/actions.js
View file @
21be7375
...
...
@@ -904,7 +904,7 @@ define([
icon
:
'
fa-share-alt-square
'
,
help_index
:
'
fz
'
,
handler
:
function
(
env
,
event
)
{
env
.
notebook
.
share
();
basthonGUI
.
share
();
if
(
event
){
event
.
preventDefault
();
}
...
...
notebook/static/notebook/js/notebook.js
View file @
21be7375
...
...
@@ -199,6 +199,10 @@ define([
attachments_celltoolbar
.
register
(
this
);
tags_celltoolbar
.
register
(
this
);
// [Basthon]
// exposing dialog module
this
.
dialog
=
dialog
;
var
that
=
this
;
Object
.
defineProperty
(
this
,
'
line_numbers
'
,
{
...
...
@@ -3071,39 +3075,6 @@ define([
document
.
body
.
removeChild
(
textArea
);
};
/** [Basthon]
* Copy notebook to clipboard then show dialog explaining.
*/
Notebook
.
prototype
.
share
=
function
(
key
=
"
ipynb
"
)
{
const
msg
=
$
(
"
<div>
"
).
html
(
`
<p>
<i class="fa fa-copy"></i>
Un lien vers la page de Basthon avec le contenu actuel du notebook
a été copié dans le presse-papier.
<p>
Vous pouvez le coller où vous voulez pour partager votre notebook.
<p>
<i class="fa fa-exclamation-circle"></i>
Attention, partager un notebook de taille trop importante peut ne
pas fonctionner avec certains navigateurs.
`
);
this
.
events
.
trigger
(
'
before_share.Notebook
'
);
this
.
_copyContentAsURL
(
key
);
dialog
.
modal
({
notebook
:
this
,
keyboard_manager
:
this
.
keyboard_manager
,
title
:
i18n
.
msg
.
_
(
"
Un lien vers ce notebook a été copié
"
),
body
:
msg
,
buttons
:
{
OK
:
{
"
class
"
:
"
btn-primary
"
}
}
});
this
.
events
.
trigger
(
'
notebook_shared.Notebook
'
);
};
/** [Basthon]
* Saving the notebook to local storage.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment