Provide option to open the demo page in new tab.
This commit is contained in:
@@ -8,5 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page_toolbar__right"></div>
|
<div class="page_toolbar__right">
|
||||||
|
<a href="{{ externalUrl }}" target="_blank" class="open_in_new_tab"></a>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
Vendored
+1
-1
@@ -11370,7 +11370,7 @@ function Publish(props = {}) {
|
|||||||
function setupPublish(rootAttributes) {
|
function setupPublish(rootAttributes) {
|
||||||
// INIT
|
// INIT
|
||||||
const wrapper = document.createElement('div');
|
const wrapper = document.createElement('div');
|
||||||
document.querySelector('.page_toolbar__right').prepend(wrapper);
|
document.querySelector('.page_toolbar__right').append(wrapper);
|
||||||
const root = createRoot(wrapper);
|
const root = createRoot(wrapper);
|
||||||
const html = /*#__PURE__*/React.createElement(Publish, {
|
const html = /*#__PURE__*/React.createElement(Publish, {
|
||||||
rootAttributes: rootAttributes
|
rootAttributes: rootAttributes
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
|||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 330 330" style="enable-background:new 0 0 330 330;" xml:space="preserve">
|
||||||
|
<path id="XMLID_225_" d="M325.607,79.393c-5.857-5.857-15.355-5.858-21.213,0.001l-139.39,139.393L25.607,79.393
|
||||||
|
c-5.857-5.857-15.355-5.858-21.213,0.001c-5.858,5.858-5.858,15.355,0,21.213l150.004,150c2.813,2.813,6.628,4.393,10.606,4.393
|
||||||
|
s7.794-1.581,10.606-4.394l149.996-150C331.465,94.749,331.465,85.251,325.607,79.393z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 553 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" fill="#21252d">
|
||||||
|
<path
|
||||||
|
d="M9.5 43.05q-1.85 0-3.2-1.35t-1.35-3.2v-29q0-1.9 1.35-3.25T9.5 4.9h13.35v4.6H9.5v29h29V25.15h4.6V38.5q0 1.85-1.35 3.2t-3.25 1.35ZM20.3 30.9l-3.15-3.2 18.2-18.2h-9.5V4.9H43.1v17.25h-4.6V12.7Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 294 B |
@@ -39,7 +39,7 @@ function Publish(props = {}) {
|
|||||||
export function setupPublish(rootAttributes) {
|
export function setupPublish(rootAttributes) {
|
||||||
// INIT
|
// INIT
|
||||||
const wrapper = document.createElement('div');
|
const wrapper = document.createElement('div');
|
||||||
document.querySelector('.page_toolbar__right').prepend(wrapper)
|
document.querySelector('.page_toolbar__right').append(wrapper)
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(wrapper);
|
const root = ReactDOM.createRoot(wrapper);
|
||||||
const html = (<Publish rootAttributes={rootAttributes}/>);
|
const html = (<Publish rootAttributes={rootAttributes}/>);
|
||||||
|
|||||||
@@ -57,21 +57,21 @@ body {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.page_toolbar .page_toolbar__middle {
|
.page_toolbar__middle {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: var(--gap);
|
gap: var(--gap);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.page_toolbar .page_toolbar__middle > div {
|
.page_toolbar__middle > div {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
.page_toolbar .page_toolbar__middle > div {
|
.page_toolbar__middle > div {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page_toolbar .page_toolbar__middle > div:not(:first-child):after {
|
.page_toolbar__middle > div:not(:first-child):after {
|
||||||
content: "|";
|
content: "|";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: calc(var(--gap) / 2 * -1);
|
left: calc(var(--gap) / 2 * -1);
|
||||||
@@ -80,7 +80,7 @@ body {
|
|||||||
line-height: 1;
|
line-height: 1;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
}
|
}
|
||||||
.page_toolbar .page_toolbar__middle > div select {
|
.page_toolbar__middle > div select {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -90,10 +90,15 @@ body {
|
|||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
}
|
}
|
||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
.page_toolbar .page_toolbar__middle__data_options {
|
.page_toolbar__middle__data_options {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.page_toolbar__right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
#preview_frame {
|
#preview_frame {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -114,4 +119,23 @@ body {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.open_in_new_tab {
|
||||||
|
--size: 1.5rem;
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
background-image: url("/scripts/toolbar/images/icon-open-new-tab.svg");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: calc(var(--size) - 0.15rem);
|
||||||
|
background-position: center center;
|
||||||
|
background-color: initial;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 0;
|
||||||
|
font-size: 1px;
|
||||||
|
color: rgba(0, 0, 0, 0);
|
||||||
|
line-height: 1;
|
||||||
|
display: block;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=page--main.css.map */
|
/*# sourceMappingURL=page--main.css.map */
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"sourceRoot":"","sources":["page--main.scss","_buttons.scss","_overlay.scss","_page--breakpoints.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;EAEA;;;ACTF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AFIF;EACE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EAHF;IAII;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EADF;IAEI;;;;AG/DR;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA","file":"page--main.css"}
|
{"version":3,"sourceRoot":"","sources":["page--main.scss","_buttons.scss","_overlay.scss","_page--breakpoints.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;EAEA;;;ACTF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AFIF;EACE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EAHF;IAII;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EADF;IAEI;;;AAKN;EACE;EACA;EACA;;;AGvEJ;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA;;;AHyDJ;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"page--main.css"}
|
||||||
@@ -25,7 +25,7 @@ body {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.page_toolbar__middle {
|
&__middle {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: var(--gap);
|
gap: var(--gap);
|
||||||
@@ -66,7 +66,33 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@import "page--breakpoints";
|
@import "page--breakpoints";
|
||||||
|
|
||||||
|
.open_in_new_tab {
|
||||||
|
--size: 1.5rem;
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
|
||||||
|
background-image: url("/scripts/toolbar/images/icon-open-new-tab.svg");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: calc(var(--size) - 0.15rem);
|
||||||
|
background-position: center center;
|
||||||
|
background-color: initial;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
border: 0;
|
||||||
|
font-size: 1px;
|
||||||
|
color: rgba(0, 0, 0, 0);
|
||||||
|
line-height: 1;
|
||||||
|
display: block;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ buildScriptFiles()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
let port = 3000;
|
let port = 3000;
|
||||||
|
let externalUrl = '';
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const hbs = create({
|
const hbs = create({
|
||||||
@@ -69,10 +70,14 @@ app.get('/', async (req, res) => {
|
|||||||
return res.send(data.errorMessage);
|
return res.send(data.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const baseView = config.has('baseView') ? config.get('baseView') : 'container';
|
||||||
|
|
||||||
data.helpers = {
|
data.helpers = {
|
||||||
port: port,
|
port,
|
||||||
include_partial: (path) => projectDir + path,
|
include_partial: (path) => projectDir + path,
|
||||||
baseView: config.has('baseView') ? config.get('baseView') : 'container',
|
baseView: baseView,
|
||||||
|
externalUrl: `${externalUrl}/view/${baseView}`,
|
||||||
|
previewFrameUrl: `http://localhost:${port}/view/${baseView}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('index', data);
|
res.render('index', data);
|
||||||
@@ -181,8 +186,10 @@ const listener = app.listen(0, async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
bs.init({
|
bs.init({
|
||||||
proxy: `http://localhost:${PORT}`, open: false
|
proxy: `http://localhost:${PORT}`,
|
||||||
|
open: false
|
||||||
}, (err, bs) => {
|
}, (err, bs) => {
|
||||||
|
externalUrl = bs.getOptionIn(["urls"]).get('external');
|
||||||
port = bs.server._connectionKey.split(':').pop();
|
port = bs.server._connectionKey.split(':').pop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user