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

Feature/JS-3309: Embed #345

Merged
merged 67 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
29b02a0
change latex to embed
ra3orblade Nov 6, 2023
8f0988c
mermaid example
ra3orblade Nov 6, 2023
4a27c92
refactoring
ra3orblade Nov 6, 2023
24af7d9
build deps
ra3orblade Nov 6, 2023
19675b8
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 6, 2023
bcbbc15
updates
ra3orblade Nov 6, 2023
145a8f5
updates
ra3orblade Nov 7, 2023
a528a72
common embed block
ra3orblade Nov 7, 2023
5fe99d7
youtube video
ra3orblade Nov 7, 2023
2727147
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 7, 2023
d97bc92
JS-3309: chart.js
ra3orblade Nov 7, 2023
5385624
updates
ra3orblade Nov 7, 2023
1cf5472
resize
ra3orblade Nov 7, 2023
3380c79
updates
ra3orblade Nov 7, 2023
f6b2e55
updates
ra3orblade Nov 7, 2023
c0dd51b
updates
ra3orblade Nov 7, 2023
4f017aa
JS-3320: embed option on pastee
ra3orblade Nov 8, 2023
c20b4e3
JS-3320: embed option on pastee
ra3orblade Nov 8, 2023
809087b
JS-3330: add embed to package
ra3orblade Nov 8, 2023
2b56506
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 8, 2023
dcc3f7c
fixes
ra3orblade Nov 8, 2023
a2432d9
fixes
ra3orblade Nov 8, 2023
01685b9
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 9, 2023
17966ae
refactoring
ra3orblade Nov 9, 2023
c756c10
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 10, 2023
3d636b4
JS-3345: Soundcloud + refactoring
ra3orblade Nov 10, 2023
67eb56c
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 13, 2023
0f240da
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 18, 2023
f8998c5
merge
ra3orblade Nov 23, 2023
3490878
merge
ra3orblade Nov 28, 2023
8ee583b
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Nov 29, 2023
31f5603
icon refactoring
ra3orblade Nov 29, 2023
c59fe49
JS-3437: design updates
ra3orblade Nov 29, 2023
fae564c
JS-3342: basic
mhlv Nov 30, 2023
3c33534
JS-3342: google maps embed
mhlv Nov 30, 2023
9a09f6e
Merge pull request #387 from anyproto/feature/JS-3342-embed-google-maps
ra3orblade Nov 30, 2023
0b7eae8
merge
ra3orblade Nov 30, 2023
2b10522
Merge branch 'feature/embed' of github.com:anyproto/anytype-ts into f…
ra3orblade Nov 30, 2023
a1416dc
JS-3373: embed miro
mhlv Nov 30, 2023
df266f4
fix embed descriptions
ra3orblade Nov 30, 2023
3d1ab56
Merge pull request #388 from anyproto/feature/JS-3373-embed-miro
ra3orblade Nov 30, 2023
5585550
Merge branch 'feature/embed' of github.com:anyproto/anytype-ts into f…
ra3orblade Nov 30, 2023
e61add0
block text miro localization
mhlv Nov 30, 2023
80c7226
JS-3452: fix
ra3orblade Dec 1, 2023
9f215d1
Merge branch 'feature/embed' of github.com:anyproto/anytype-ts into f…
ra3orblade Dec 1, 2023
a960c41
JS-3461: empty state
ra3orblade Dec 4, 2023
0c44b36
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Dec 5, 2023
d11b6d5
rename blockEmbed to blockLatex because of protocol change
ra3orblade Dec 5, 2023
559eaf7
remove debug
ra3orblade Dec 5, 2023
b745826
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Dec 6, 2023
f55d5d2
embed fixes
ra3orblade Dec 6, 2023
84fdd09
JS-3473: embed preview
mhlv Dec 6, 2023
34d9518
JS-3473: withPreview state
mhlv Dec 6, 2023
bd2e2c0
JS-3473: dark mode colors
mhlv Dec 6, 2023
5ece7a8
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Dec 6, 2023
07a0ca0
JS-3473: latex exception
mhlv Dec 6, 2023
0b9fe10
change google api to key url
ra3orblade Dec 6, 2023
9424b87
fix
ra3orblade Dec 6, 2023
8599425
Merge pull request #400 from anyproto/feature/JS-3473-embed-block-pre…
ra3orblade Dec 7, 2023
e7538cd
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/embed
ra3orblade Dec 8, 2023
056c859
JS-3499, JS-3500, JS-3501, JS-3505, JS-3508
ra3orblade Dec 8, 2023
f087d16
new icons
ra3orblade Dec 8, 2023
fa9dbed
fixes
ra3orblade Dec 8, 2023
6da19dc
fixes
ra3orblade Dec 8, 2023
63b7852
JS-3503: fix
ra3orblade Dec 8, 2023
45029f3
placeholder
ra3orblade Dec 8, 2023
962ec83
refactoring
ra3orblade Dec 8, 2023
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
14 changes: 14 additions & 0 deletions dist/embed/chart/chart.umd.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/embed/chart/chart.umd.js.map

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions dist/embed/iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* { margin: 0px; padding: 0px; }

html, body { height: 100%; }

body { background-color: #fff; }
body.dark { background-color: #171717; }

iframe { width: 100% !important; height: 100% !important; }
</style>
</head>
<body>
<script type="text/javascript">

window.addEventListener('message', e => {
if (!e.origin.match(/\/\/localhost:/) && (e.origin !== null)) {
return;
};

const body = document.body;
const { html, js, theme, libs } = e.data;

loadLibs(libs, () => {
body.innerHTML = html;
body.className = theme;

if (js) {
try {
eval(js);
} catch (e) {
console.error(e);
};
};

resize(e);
});
});

window.addEventListener('resize', resize);

window.onerror = function (message, url, lineNumber) {
return true;
};

function resize (e) {
window.parent.postMessage({ height: document.documentElement.scrollHeight }, '*');
};

function loadLibs (list, callBack) {
if (!list.length) {
if (callBack) {
callBack();
};
return;
};

const src = list.shift();
const script = document.createElement('script');

document.head.appendChild(script);

script.onload = function (e) {
if (list.length) {
loadScripts(list, callBack);
} else
if (callBack) {
callBack();
};
};

script.type = 'text/javascript';
script.src = src;
};
</script>
</body>
</html>
17 changes: 6 additions & 11 deletions electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ const WindowManager = require('./electron/js/window.js');
const Server = require('./electron/js/server.js');
const Util = require('./electron/js/util.js');

const csp = [
`default-src 'self' 'unsafe-eval' blob: http://localhost:*`,
`img-src 'self' http://*:* https://*:* data: blob: file://*`,
`media-src 'self' http://*:* https://*:* data: blob: file://*`,
`style-src 'unsafe-inline' http://localhost:* file://*`,
`font-src data: file://* http://localhost:*`,
`connect-src file://* http://localhost:* http://127.0.0.1:* ws://localhost:* https://*.anytype.io https://api.amplitude.com/ devtools://devtools data:`,
`script-src-elem file: http://localhost:* https://sentry.io devtools://devtools 'unsafe-inline'`,
`frame-src chrome-extension://react-developer-tools`,
`worker-src 'self' 'unsafe-eval' blob: http://localhost:*`,
];
const Cors = require('./electron/json/cors.json');
const csp = [];

for (let i in Cors) {
csp.push([ i ].concat(Cors[i]).join(' '));
};

app.commandLine.appendSwitch('ignore-connections-limit', 'localhost, 127.0.0.1');
app.removeAsDefaultProtocolClient(protocol);
Expand Down
116 changes: 116 additions & 0 deletions electron/json/cors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"default-src": [
"'self'",
"'unsafe-eval'",
"blob:",
"http://localhost:*"
],

"img-src": [
"'self'",
"http://*:*",
"https://*:*",
"data:",
"blob:",
"file://*",
"https://*.sndcdn.com"
],

"media-src": [
"'self'",
"http://*:*",
"https://*:*",
"data:",
"blob:",
"file://*",
"https://*.googlevideo.com"
],

"style-src": [
"'unsafe-inline'",
"http://localhost:*",
"file://*",
"https://*.youtube.com",
"https://*.vimeocdn.com",
"https://*.gstatic.com",
"https://*.googleapis.com",
"https://mirostatic.com",
"https://miro.com",
"https://*.google.com"
],

"font-src": [
"data:",
"file://*",
"http://localhost:*",
"https://*.youtube.com",
"https://*.vimeocdn.com",
"https://*.gstatic.com",
"https://mirostatic.com",
"https://miro.com"
],

"connect-src": [
"file://*",
"data:",
"http://localhost:*",
"http://127.0.0.1:*",
"ws://localhost:*",
"https://*.anytype.io",
"https://api.amplitude.com",
"devtools://devtools",
"https://*.youtube.com",
"https://*.vimeocdn.com",
"https://*.vimeo.com",
"https://*.googlevideo.com",
"https://*.akamaized.net",
"https://*.soundcloud.com",
"https://*.sndcdn.com",
"https://*.google.com",
"https://*.googleapis.com",
"https://*.doubleclick.net",
"https://miro.com",
"https://*.miro.com",
"https://*.cookielaw.org",
"https://*.sentry.io",
"https://*.split.io",
"https://*.onetrust.com",
"https://mirostatic.com",
"wss://miro.com"
],

"script-src-elem": [
"file:",
"'unsafe-inline'",
"http://localhost:*",
"https://sentry.io",
"devtools://devtools",
"https://*.youtube.com",
"https://*.vimeocdn.com",
"https://*.gstatic.com",
"https://*.sndcdn.com",
"https://*.google.com",
"https://*.googleapis.com",
"https://*.doubleclick.net",
"https://*.cookielaw.org",
"https://mirostatic.com"
],

"frame-src": [
"chrome-extension://react-developer-tools",
"http://localhost:*/embed/iframe.html",
"https://*.youtube.com",
"https://*.vimeo.com",
"https://w.soundcloud.com",
"https://*.google.com",
"https://miro.com",
"https://*.miro.com"
],

"worker-src": [
"'self'",
"'unsafe-eval'",
"blob:",
"http://localhost:*"
]
}
Loading