Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit7384236

Browse files
authored
Revert "feat: implement backward/forward navigation options to iframed window (#181)"
This reverts commit8ff785c.
1 parent450199e commit7384236

File tree

5 files changed

+26
-142
lines changed

5 files changed

+26
-142
lines changed

‎pnpm-lock.yaml‎

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/routes/tutorial/[slug]/+page.svelte‎

Lines changed: 12 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,15 @@
9595
9696
/**@type{import('$lib/types').Adapter | undefined}*/
9797
let adapter;
98-
/**@type{string[]}*/
99-
let history_bwd= [];
100-
/**@type{string[]}*/
101-
let history_fwd= [];
102-
let ignore_path_change=false;
103-
104-
functionreset_history() {
105-
history_bwd= [];
106-
history_fwd= [];
107-
}
10898
10999
onMount(()=> {
110-
functionon_iframe_load() {
111-
iframe.classList.add('loaded');
112-
}
113100
functiondestroy() {
114-
iframe.removeEventListener('load', on_iframe_load);
115101
if (adapter) {
116102
adapter.destroy();
117103
}
118104
}
119105
120106
document.addEventListener('pagehide', destroy);
121-
iframe.addEventListener('load', on_iframe_load);
122107
return destroy;
123108
});
124109
@@ -137,7 +122,6 @@
137122
loading=true;
138123
139124
reset_complete_states();
140-
reset_history();
141125
142126
awaitreset_adapter($files);
143127
@@ -270,16 +254,7 @@
270254
if (e.origin!==adapter.base)return;
271255
272256
if (e.data.type==='ping') {
273-
constnew_path=e.data.data.path?? path;
274-
if (path!== new_path) {
275-
// skip `nav_to` step if triggered by bwd/fwd action
276-
if (ignore_path_change) {
277-
ignore_path_change=false;
278-
}else {
279-
nav_to();
280-
}
281-
path= new_path;
282-
}
257+
path=e.data.data.path?? path;
283258
284259
clearTimeout(timeout);
285260
timeout=setTimeout(()=> {
@@ -322,47 +297,10 @@
322297
// change the src without adding a history entry, which
323298
// would make back/forward traversal very annoying
324299
constparentNode=/**@type{HTMLElement}*/ (iframe.parentNode);
325-
iframe.classList.remove('loaded');
326300
parentNode?.removeChild(iframe);
327301
iframe.src= src;
328302
parentNode?.appendChild(iframe);
329303
}
330-
331-
/**@param{string}path*/
332-
functionroute_to(path) {
333-
if (adapter) {
334-
consturl=newURL(path,adapter.base);
335-
path=url.pathname+url.search+url.hash;
336-
set_iframe_src(adapter.base+ path);
337-
}
338-
}
339-
340-
/**@param{string | null}new_path*/
341-
functionnav_to(new_path=null) {
342-
if (path!== history_bwd[history_bwd.length-1]) {
343-
history_bwd= [...history_bwd, path];
344-
}
345-
history_fwd= [];
346-
if (new_path)route_to(new_path);
347-
}
348-
349-
functiongo_bwd() {
350-
constnew_path= history_bwd[history_bwd.length-1];
351-
if (new_path) {
352-
ignore_path_change=true;
353-
[history_bwd, history_fwd]= [history_bwd.slice(0,-1), [path,...history_fwd]];
354-
route_to(new_path);
355-
}
356-
}
357-
358-
functiongo_fwd() {
359-
constnew_path= history_fwd[0];
360-
if (new_path) {
361-
ignore_path_change=true;
362-
[history_bwd, history_fwd]= [[...history_bwd, path],history_fwd.slice(1)];
363-
route_to(new_path);
364-
}
365-
}
366304
</script>
367305
368306
<svelte:window on:message={handle_message} bind:innerWidth={width}/>
@@ -462,18 +400,20 @@
462400
463401
<section slot="b"class="preview">
464402
<Chrome
465-
{history_bwd}
466-
{history_fwd}
467403
{path}
468404
{loading}
469405
on:refresh={()=> {
470406
if (adapter) {
471407
set_iframe_src(adapter.base+ path);
472408
}
473409
}}
474-
on:change={(e)=>nav_to(e.detail.value)}
475-
on:back={go_bwd}
476-
on:forward={go_fwd}
410+
on:change={(e)=> {
411+
if (adapter) {
412+
consturl=newURL(e.detail.value,adapter.base);
413+
path=url.pathname+url.search+url.hash;
414+
set_iframe_src(adapter.base+ path);
415+
}
416+
}}
477417
/>
478418
479419
<divclass="content">
@@ -503,7 +443,6 @@
503443
.content {
504444
display: flex;
505445
flex-direction: column;
506-
position: relative;
507446
min-height:0;
508447
height:100%;
509448
max-height:100%;
@@ -546,6 +485,10 @@
546485
flex-direction: column;
547486
}
548487
488+
.content {
489+
position: relative;
490+
}
491+
549492
iframe {
550493
width:100%;
551494
height:100%;
@@ -556,10 +499,6 @@
556499
background:var(--sk-back-2);
557500
}
558501
559-
iframe:not(.loaded) {
560-
display: none;
561-
}
562-
563502
.editor-container {
564503
position: relative;
565504
background-color:var(--sk-back-3);
Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
11
<script>
22
import {createEventDispatcher }from'svelte';
3-
importchevronfrom'./chevron.svg';
43
importrefreshfrom'./refresh.svg';
54
65
/**@type{string}*/
76
exportlet path;
87
9-
/**@type{string[]}*/
10-
exportlet history_bwd= [];
11-
12-
/**@type{string[]}*/
13-
exportlet history_fwd= [];
14-
158
/**@type{boolean}*/
169
exportlet loading;
1710
1811
constdispatch=createEventDispatcher();
19-
20-
$: [disabledBwd, disabledFwd]= [loading||!history_bwd.length, loading||!history_fwd.length];
2112
</script>
2213

2314
<divclass="chrome">
24-
<buttondisabled={disabledBwd}on:click={()=>dispatch('back')}aria-label="go back">
25-
<imgsrc={chevron}alt="Back icon" />
26-
</button>
27-
<buttondisabled={disabledFwd}on:click={()=>dispatch('forward')}aria-label="go forward">
28-
<imgsrc={chevron}style="transform: rotate(180deg)"alt="Forward icon" />
29-
</button>
30-
<button
31-
class="refresh"
32-
disabled={loading}
33-
on:click={()=>dispatch('refresh')}
34-
aria-label="reload"
35-
>
15+
<buttondisabled={loading}on:click={()=>dispatch('refresh')}aria-label="reload">
3616
<imgsrc={refresh}alt="Reload icon" />
3717
</button>
3818

@@ -63,11 +43,11 @@
6343
.chromebuttonimg {
6444
width:2rem;
6545
height:2rem;
66-
transition:transform0.2sease-out, opacity0.1sease-out;
46+
transition:0.2sease-out;
6747
transform:none;
6848
}
6949
70-
.chromebutton.refresh:activeimg {
50+
.chromebutton:activeimg {
7151
transform:rotate(-360deg);
7252
transition:none;
7353
}
@@ -91,26 +71,4 @@
9171
outline:none;
9272
border:2pxsolidvar(--sk-theme-3);
9373
}
94-
95-
.chromebutton {
96-
user-select:none;
97-
}
98-
99-
.chromebutton[disabled] {
100-
opacity:1;
101-
}
102-
103-
.chromebutton[disabled]img {
104-
opacity:0.5;
105-
}
106-
107-
.chromebuttonimg {
108-
opacity:0.8;
109-
}
110-
111-
.chromebutton:hoverimg,
112-
.chromebutton:activeimg,
113-
.chromebutton:focus-visibleimg {
114-
opacity:1;
115-
}
11674
</style>

‎src/routes/tutorial/[slug]/chevron.svg‎

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 3 additions & 5 deletions
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp