Developer-Dashboard
view release on metacpan or search on metacpan
lib/Developer/Dashboard/Web/App.pm view on Meta::CPAN
# _edit_html($page)
# Renders the browser edit/source view for a page.
# Input: page document object.
# Output: HTML string.
sub _edit_html {
my ( $self, $page ) = @_;
my $raw_source = $page->{meta}{raw_instruction} || $page->canonical_instruction;
my $source = $raw_source;
$source =~ s/&/&/g;
$source =~ s/</</g;
$source =~ s/>/>/g;
my $urls = $self->_page_route_urls($page);
my $form_action = $urls->{form_action} || '/';
my $title = $page->as_hash->{title};
$title =~ s/&/&/g;
$title =~ s/</</g;
$title =~ s/>/>/g;
my $html = <<'HTML';
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>__TITLE__</title>
<style>
body { margin: 0; font-family: Georgia, serif; background: #f5efe2; color: #1f2a2e; }
main { max-width: 980px; margin: 32px auto; background: #fffef9; border: 1px solid #ddd3c2; padding: 24px; }
.editor-stack {
position: relative;
min-height: 520px;
border: 1px solid #2a2f36;
background: #1f2328;
overflow: hidden;
}
.editor-overlay,
.instruction-block-editor {
display: block;
width: 100%;
min-height: 520px;
box-sizing: border-box;
margin: 0;
padding: 12px;
font-family: Menlo, Consolas, "Courier New", monospace;
font-size: 14px;
line-height: 21px;
white-space: pre;
word-break: normal;
overflow-wrap: normal;
overflow: auto;
tab-size: 4;
letter-spacing: 0;
}
.editor-overlay-viewport {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
background: transparent;
}
.editor-overlay {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
color: #e6edf3;
background: transparent;
unicode-bidi: plaintext;
direction: ltr;
will-change: transform;
}
.instruction-block-editor {
position: relative;
z-index: 1;
min-height: 220px;
color: transparent;
border: 0;
resize: vertical;
background: transparent;
caret-color: #f8f8f2;
outline: none;
-webkit-text-fill-color: transparent;
unicode-bidi: plaintext;
direction: ltr;
overflow: auto;
scrollbar-gutter: stable both-edges;
}
.instruction-block-editor::selection {
background: rgba(121, 192, 255, 0.35);
-webkit-text-fill-color: transparent;
}
.instruction-source {
display: none;
}
.editor-blocks {
display: grid;
gap: 16px;
}
.editor-block {
display: grid;
gap: 8px;
}
.editor-block-label {
color: #9da7b3;
font: 600 12px/1.4 Menlo, Consolas, "Courier New", monospace;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.editor-hint {
color: #727b84;
font-size: 12px;
margin-bottom: 12px;
}
.tok-directive { color: #ffd866; font-weight: normal; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.tok-separator { color: #5c6370; }
.tok-html { color: #78dce8; }
.tok-tag { color: #ff7ab2; }
.tok-attr { color: #ffcf6a; }
.tok-value { color: #a9dc76; }
.tok-css { color: #78dce8; }
.tok-js { color: #ab9df2; }
.tok-code { color: #a9dc76; }
.tok-perl-keyword { color: #ff7ab2; }
.tok-perl-var { color: #78dce8; }
.tok-string { color: #ffd866; }
.tok-comment { color: #727b84; }
.tok-note { color: #ff6188; }
a, .chrome-button {
color: #0b7a75;
margin-right: 18px;
text-decoration: none;
}
.chrome-button {
border: 0;
background: none;
padding: 0;
font: inherit;
cursor: pointer;
}
</style>
</head>
<body>
<main>
__TOP_CHROME__
<form method="post" action="__FORM_ACTION__" id="instruction-form">
<input type="hidden" name="mode" id="instruction-mode" value="edit">
<div class="editor-hint">Each bookmark section is edited as its own block. Press Tab inside a block to start the next section.</div>
<textarea class="instruction-source" id="instruction-source" name="instruction" wrap="off" spellcheck="false" autocapitalize="off" autocomplete="off" autocorrect="off">__SOURCE__</textarea>
<div class="editor-blocks" id="instruction-blocks"></div>
</form>
( run in 1.738 second using v1.01-cache-2.11-cpan-7fcb06a456a )