Moving on
This commit is contained in:
1 parent
f2cc603195
commit
b73c401ff4
14 files changed
+71
-217
No files matched your search
@@ -1,12 +0,0 @@
|
||||
@inherits FileItemBase
|
||||
|
||||
<a class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">
|
||||
<p class="is-size-7"><sub>@File.Folder</sub></p>
|
||||
<p class="@(File.CanBeDeleted ? "has-text-danger" : null)">
|
||||
@File.Name
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@@ -1,16 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Seenginx.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Seenginx.Components
|
||||
{
|
||||
public class FileItemBase : ComponentBase
|
||||
{
|
||||
[Parameter]
|
||||
public ConfigFile File { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
@typeparam CFile
|
||||
|
||||
<div class="filesWithEditor">
|
||||
|
||||
<div class="tile is-parent is-4 is-vertical">
|
||||
<div class="tile is-child">
|
||||
<div class="buttons are-small">
|
||||
<button class="button is-static is-outlined"><span class="icon is-small"><i class="mdi mdi-filter-outline"></i></span></button>
|
||||
@foreach (var filter in Filters)
|
||||
{
|
||||
<button @onclick="e => OnFilterClick(e,filter)" class="button is-outlined">@filter</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-child">
|
||||
<div class="field">
|
||||
<p class="control has-icons-left">
|
||||
<input formnovalidate value="@SearchInput" @onchange="e => SearchInputChanged(e)" class="input is-small is-primary" type="text" placeholder="Search...">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="mdi mdi-search-web"></i>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-child is-vertical">
|
||||
<aside class="menu">
|
||||
<ul class="menu-list">
|
||||
@foreach (var file in Files)
|
||||
{
|
||||
<li @onclick="e => OnFileClick(e,file)" @key="file" class="@file.IsVisible">
|
||||
<FileItem File="file" @key="file"></FileItem>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
<div class="tile is-child">
|
||||
<div class="buttons are-small is-centered has-addons">
|
||||
<button class="button is-primary" @onclick="OnAddDialog">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-plus-box-outline"></i>
|
||||
</span>
|
||||
<span>Add</span>
|
||||
</button>
|
||||
<button class="button is-warning" @onclick="OnUpdateDialog">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-pencil-box-outline"></i>
|
||||
</span>
|
||||
<span>Update</span>
|
||||
</button>
|
||||
<button class="button is-danger" @onclick="OnDeleteDialog">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-minus-box-outline"></i>
|
||||
</span>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tile is-parent is-vertical is-8">
|
||||
@Editor
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Seenginx.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Seenginx.Components
|
||||
{
|
||||
public partial class FilesWithEditor<CFile> : ComponentBase
|
||||
where CFile : ConfigFile
|
||||
{
|
||||
[Parameter]
|
||||
public List<CFile> Files { get; set; } = new List<CFile>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> Filters { get; set; } = new List<string>();
|
||||
[Parameter]
|
||||
public List<int> FilteredOutFiles { get; set; } = new List<int>();
|
||||
[Parameter]
|
||||
public EventCallback<string> ApplyFilter { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback AddFile { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<CFile> UpdateFile { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<CFile> DeleteFile { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> Editor { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> CreateDialog { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> UpdateDialog { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> DeleteDialog { get; set; }
|
||||
|
||||
protected bool IsAnyFileSelected => SelectedFile != default;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<CFile> SelectedFileChanged { get; set; }
|
||||
[Parameter]
|
||||
public CFile SelectedFile { get; set; }
|
||||
|
||||
protected string SearchInput { get; set; } = string.Empty;
|
||||
|
||||
protected async Task OnDeselectClick()
|
||||
{
|
||||
SelectedFile = null;
|
||||
await SelectedFileChanged.InvokeAsync(SelectedFile);
|
||||
}
|
||||
|
||||
protected async Task OnFilterClick(MouseEventArgs e, string filter)
|
||||
{
|
||||
await ApplyFilter.InvokeAsync(filter);
|
||||
//for (int index = 0; index < Files.Count; index++)
|
||||
// if (FilteredOutFiles.Contains(index))
|
||||
// Files[index].Hide();
|
||||
// else
|
||||
// Files[index].Unhide();
|
||||
}
|
||||
|
||||
protected async Task SearchInputChanged(ChangeEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SearchInput))
|
||||
Files.ForEach(f => f.Unhide());
|
||||
else
|
||||
Files.ForEach(f =>
|
||||
{
|
||||
if (f.Name.ToLower().Contains(SearchInput.ToLower()))
|
||||
f.Unhide();
|
||||
else
|
||||
f.Hide();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task OnFileClick(MouseEventArgs e, CFile file)
|
||||
{
|
||||
await SelectedFileChanged.InvokeAsync(file);
|
||||
}
|
||||
|
||||
protected async Task OnAddDialog()
|
||||
{
|
||||
await AddFile.InvokeAsync(null);
|
||||
}
|
||||
protected async Task OnUpdateDialog()
|
||||
{
|
||||
await UpdateFile.InvokeAsync(SelectedFile);
|
||||
}
|
||||
protected async Task OnDeleteDialog()
|
||||
{
|
||||
await UpdateFile.InvokeAsync(SelectedFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,11 @@ namespace Seenginx.Models
|
||||
public string Permissions { get; set; }
|
||||
public bool CanBeDeleted { get; set; } = true;
|
||||
public string IsVisible { get; set; } = string.Empty;
|
||||
public string IsSelected { get; set; } = string.Empty;
|
||||
|
||||
public void Hide() { IsVisible = "is-hidden"; }
|
||||
public void Unhide() { IsVisible = string.Empty; }
|
||||
public void Select() { IsSelected = "is-active"; }
|
||||
public void Deselect() { IsSelected = string.Empty; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
@inherits FileItemBase
|
||||
<a>
|
||||
<p class="subtitle is-6"><sub>@File.Folder</sub></p>
|
||||
<h6 class="title is-6 @(File.CanBeDeleted ? null : "has-text-danger")">@File.Name</h6>
|
||||
</a>
|
||||
|
||||
<a class="@File.IsSelected" @onclick="SelectFile">
|
||||
<p class="subtitle is-6"><sub>@File.Folder</sub></p>
|
||||
<h6 class="title is-6 @(File.CanBeDeleted ? null : "has-text-danger")">@File.Name</h6>
|
||||
</a>
|
||||
@@ -1,8 +1,7 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Seenginx.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Seenginx.Components
|
||||
{
|
||||
@@ -10,6 +9,13 @@ namespace Seenginx.Components
|
||||
{
|
||||
[Parameter]
|
||||
public ConfigFile File { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<ConfigFile> SelectedFileChanged { get; set; }
|
||||
|
||||
public async Task SelectFile(MouseEventArgs e)
|
||||
{
|
||||
await SelectedFileChanged.InvokeAsync(File);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filesList neomorphSmall borderRSmall sameMarginBottom">
|
||||
<div class="filesList neomorphInsetSmall borderRSmall sameMarginBottom">
|
||||
<aside class="menu">
|
||||
<ul class="menu-list">
|
||||
@foreach (var file in Files)
|
||||
@@ -62,8 +62,40 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tile is-parent is-vertical is-8">
|
||||
@Editor
|
||||
<div class="tile is-parent is-vertical">
|
||||
@if (IsAnyFileSelected)
|
||||
{
|
||||
|
||||
<nav class="level">
|
||||
|
||||
<div class="level-left">
|
||||
<div class="level-item">
|
||||
<p class="subtitle is-5">
|
||||
@SelectedFile.Name
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<div class="buttons has-addons-right">
|
||||
<button class="button is-rounded is-light is-small has-icon-left"><span class="icon is-small is-left"><i class="mdi mdi-content-save-alert-outline"></i></span> <span>Save draft</span></button>
|
||||
<button class="button is-rounded is-dark is-small has-icon-left"><span class="icon is-small is-left"><i class="mdi mdi-undo-variant"></i></span> <span>Undo changes</span></button>
|
||||
<button class="button is-rounded is-success is-small has-icon-left"><span class="icon is-small is-left"><i class="mdi mdi-content-save-all-outline"></i></span> <span>Save</span></button>
|
||||
<button class="button is-rounded is-warning is-small has-icon-left"><span class="icon is-small is-left"><i class="mdi mdi-alert-outline"></i></span> <span>Test</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
<div class="content">
|
||||
<textarea class="textarea" placeholder="Uhu" rows="20" @bind="SelectedFile.OriginalBody"></textarea>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p class="title">Select any file to start editing...</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Seenginx.Components
|
||||
public EventCallback<CFile> DeleteFile { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> Editor { get; set; }
|
||||
public RenderFragment<CFile> Editor { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<CFile> CreateDialog { get; set; }
|
||||
@@ -47,7 +47,7 @@ namespace Seenginx.Components
|
||||
[Parameter]
|
||||
public EventCallback<CFile> SelectedFileChanged { get; set; }
|
||||
[Parameter]
|
||||
public CFile SelectedFile { get; set; }
|
||||
public CFile SelectedFile { get; set; } = default;
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<FilesWithEditor CFile="ConfigFile" Filters="Filters" Files="ConfigFiles" FilterFolder="FilterFolder"
|
||||
SelectedFile="SelectedFile" SelectedFileChanged="SelectedFileChanged"
|
||||
AddFile="AddFile" UpdateFile="UpdateFile" DeleteFile="DeleteFile" >
|
||||
AddFile="AddFile" UpdateFile="UpdateFile" DeleteFile="DeleteFile">
|
||||
<CreateDialog>
|
||||
|
||||
</CreateDialog>
|
||||
@@ -14,8 +14,5 @@
|
||||
<DeleteDialog>
|
||||
|
||||
</DeleteDialog>
|
||||
<Editor>
|
||||
<p>Qualcosa</p>
|
||||
</Editor>
|
||||
</FilesWithEditor>
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
&Bottom {
|
||||
filter: drop-shadow(8px 8px 14px rgba($dark-shadow, 1));
|
||||
}
|
||||
|
||||
&Inset {
|
||||
box-shadow: inset 8px 8px 16px rgba($dark-shadow, .5), inset -8px -8px 16px rgba($light-shadow, .5);
|
||||
|
||||
&Small {
|
||||
box-shadow: inset 6px 6px 12px rgba($dark-shadow, .5), inset -6px -6px 12px rgba($light-shadow, .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.gradientBackground {
|
||||
@@ -62,6 +70,6 @@
|
||||
background: $background
|
||||
}
|
||||
|
||||
.sameMarginBottom{
|
||||
.sameMarginBottom {
|
||||
margin-bottom: 1rem !important
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,10 @@
|
||||
box-shadow: -6px -6px 12px rgba(251, 238, 208, 0.5), 6px 6px 12px rgba(241, 185, 65, 0.5); }
|
||||
.neomorphBottom {
|
||||
filter: drop-shadow(8px 8px 14px #f1b941); }
|
||||
.neomorphInset {
|
||||
box-shadow: inset 8px 8px 16px rgba(241, 185, 65, 0.5), inset -8px -8px 16px rgba(251, 238, 208, 0.5); }
|
||||
.neomorphInsetSmall {
|
||||
box-shadow: inset 6px 6px 12px rgba(241, 185, 65, 0.5), inset -6px -6px 12px rgba(251, 238, 208, 0.5); }
|
||||
|
||||
.gradientBackground {
|
||||
background: linear-gradient(to right bottom, #f7d794, #f5cd79); }
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.isHidden{display:none;}@media only screen and (max-width:37.5em){.isHiddenMobile{display:none;}}.petiteCaps{font-variant:petite-caps;}.flexCenter{display:flex;align-content:center;align-items:center;}.isNoWrap{white-space:nowrap;}.isFinger{cursor:pointer;}.neomorph{box-shadow:-8px -8px 16px rgba(251,238,208,.5),8px 8px 16px rgba(241,185,65,.5);}.neomorphSmall{box-shadow:-6px -6px 12px rgba(251,238,208,.5),6px 6px 12px rgba(241,185,65,.5);}.neomorphBottom{filter:drop-shadow(8px 8px 14px #f1b941);}.gradientBackground{background:linear-gradient(to right bottom,#f7d794,#f5cd79);}.borderR{border-radius:14px;}.borderRSmall{border-radius:7px;}.borderRBig{border-radius:28px;}.bg{background:#f6d287;}.sameMarginBottom{margin-bottom:1rem !important;}@font-face{font-family:'Ubuntu';src:url(/fonts/ubuntu-light-webfont.woff2) format("woff2");font-weight:300;font-style:normal;}@font-face{font-family:'Ubuntu-Mono';src:url(/fonts/ubuntumono-regular-webfont.woff2) format("woff2");font-style:normal;}html{font-family:Ubuntu,sans-serif;}.pure-menu-heading{text-transform:none;font-family:Ubuntu-Mono,'Noto Mono';}.menu-list li a{font-family:Ubuntu-Mono,'Noto Mono';}.menu-list a.active{background-color:#3273dc;color:#fff;}.main{display:flex;flex-wrap:nowrap;align-items:start;width:100%;height:100vh;padding:2.5%;}.mainNav{overflow-y:auto;padding:14px;width:17%;margin-right:40px;}.mainPage{overflow-y:auto;padding:28px;width:calc(83% - 40px);align-self:stretch;}.files{display:flex;flex-direction:column;align-items:stretch;}.filesWithEditor{display:flex;align-items:stretch;height:100%;}.files .buttons{justify-content:space-between;align-items:stretch;}.filesList{height:100%;overflow-y:auto;}
|
||||
#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.isHidden{display:none;}@media only screen and (max-width:37.5em){.isHiddenMobile{display:none;}}.petiteCaps{font-variant:petite-caps;}.flexCenter{display:flex;align-content:center;align-items:center;}.isNoWrap{white-space:nowrap;}.isFinger{cursor:pointer;}.neomorph{box-shadow:-8px -8px 16px rgba(251,238,208,.5),8px 8px 16px rgba(241,185,65,.5);}.neomorphSmall{box-shadow:-6px -6px 12px rgba(251,238,208,.5),6px 6px 12px rgba(241,185,65,.5);}.neomorphBottom{filter:drop-shadow(8px 8px 14px #f1b941);}.neomorphInset{box-shadow:inset 8px 8px 16px rgba(241,185,65,.5),inset -8px -8px 16px rgba(251,238,208,.5);}.neomorphInsetSmall{box-shadow:inset 6px 6px 12px rgba(241,185,65,.5),inset -6px -6px 12px rgba(251,238,208,.5);}.gradientBackground{background:linear-gradient(to right bottom,#f7d794,#f5cd79);}.borderR{border-radius:14px;}.borderRSmall{border-radius:7px;}.borderRBig{border-radius:28px;}.bg{background:#f6d287;}.sameMarginBottom{margin-bottom:1rem !important;}@font-face{font-family:'Ubuntu';src:url(/fonts/ubuntu-light-webfont.woff2) format("woff2");font-weight:300;font-style:normal;}@font-face{font-family:'Ubuntu-Mono';src:url(/fonts/ubuntumono-regular-webfont.woff2) format("woff2");font-style:normal;}html{font-family:Ubuntu,sans-serif;}.pure-menu-heading{text-transform:none;font-family:Ubuntu-Mono,'Noto Mono';}.menu-list li a{font-family:Ubuntu-Mono,'Noto Mono';}.menu-list a.active{background-color:#3273dc;color:#fff;}.main{display:flex;flex-wrap:nowrap;align-items:start;width:100%;height:100vh;padding:2.5%;}.mainNav{overflow-y:auto;padding:14px;width:17%;margin-right:40px;}.mainPage{overflow-y:auto;padding:28px;width:calc(83% - 40px);align-self:stretch;}.files{display:flex;flex-direction:column;align-items:stretch;}.filesWithEditor{display:flex;align-items:stretch;height:100%;}.files .buttons{justify-content:space-between;align-items:stretch;}.filesList{height:100%;overflow-y:auto;}
|
||||
@@ -0,0 +1 @@
|
||||
export function CodeJar(a,b,c={}){function d(){const b=window.getSelection(),c={start:0,end:0,dir:void 0};return o(a,a=>{if(a===b.anchorNode&&a===b.focusNode)return c.start+=b.anchorOffset,c.end+=b.focusOffset,c.dir=b.anchorOffset<=b.focusOffset?"->":"<-","stop";if(a===b.anchorNode){if(c.start+=b.anchorOffset,!c.dir)c.dir="->";else return"stop";}else if(a===b.focusNode)if(c.end+=b.focusOffset,!c.dir)c.dir="<-";else return"stop";a.nodeType===Node.TEXT_NODE&&("->"!=c.dir&&(c.start+=a.nodeValue.length),"<-"!=c.dir&&(c.end+=a.nodeValue.length))}),c}function e(b){const c=window.getSelection();let d,e,f=0,g=0;if(b.dir||(b.dir="->"),0>b.start&&(b.start=0),0>b.end&&(b.end=0),"<-"==b.dir){const{start:a,end:c}=b;b.start=c,b.end=a}let h=0;o(a,a=>{if(a.nodeType===Node.TEXT_NODE){const c=(a.nodeValue||"").length;return h+c>=b.start&&(d||(d=a,f=b.start-h),h+c>=b.end)?(e=a,g=b.end-h,"stop"):void(h+=c)}}),d||(d=a),e||(e=a),"<-"==b.dir&&([d,f,e,g]=[e,g,d,f]),c.setBaseAndExtent(d,f,e,g)}function f(){const b=window.getSelection(),c=b.getRangeAt(0),d=document.createRange();return d.selectNodeContents(a),d.setEnd(c.startContainer,c.startOffset),d.toString()}function g(){const b=window.getSelection(),c=b.getRangeAt(0),d=document.createRange();return d.selectNodeContents(a),d.setStart(c.endContainer,c.endOffset),d.toString()}function h(a){if("Enter"===a.key){const b=f(),c=g();let[h]=u(b),i=h;if("{"===b[b.length-1]&&(i+=w.tab),D?(a.preventDefault(),s("\n"+i)):0<i.length&&(a.preventDefault(),s("\n"+i)),i!==h&&"}"===c[0]){const a=d();s("\n"+h),e(a)}}}function i(a){const b=`)]}'"`,c=g();if(b.includes(a.key)&&c.substr(0,1)===a.key){const b=d();a.preventDefault(),b.start=++b.end,e(b)}else if("([{'\"".includes(a.key)){const c=d();a.preventDefault();const f=a.key+b[`([{'"`.indexOf(a.key)];s(f),c.start=++c.end,e(c)}}function j(a){var b=Math.min;if("Tab"===a.key)if(a.preventDefault(),a.shiftKey){const a=f();let[c,g]=u(a);if(0<c.length){const a=d(),f=b(w.tab.length,c.length);e({start:g,end:g+f}),document.execCommand("delete"),a.start-=f,a.end-=f,e(a)}}else s(w.tab)}function k(a){if("ArrowLeft"===a.key&&a.metaKey){a.preventDefault();const b=f();let[c,g,h]=u(b);if(b.endsWith(c)){if(a.shiftKey){const a=d();e({start:g,end:a.end})}else e({start:g,end:g});}else if(a.shiftKey){const a=d();e({start:h,end:a.end})}else e({start:h,end:h})}}function l(b){if(q(b)){b.preventDefault(),B--;const c=A[B];c&&(a.innerHTML=c.html,e(c.pos)),0>B&&(B=0)}if(r(b)){b.preventDefault(),B++;const c=A[B];c&&(a.innerHTML=c.html,e(c.pos)),B>=A.length&&B--}}function m(){if(!C)return;const b=a.innerHTML,c=d(),e=A[B];if(e&&e.html===b&&e.pos.start===c.start&&e.pos.end===c.end)return;B++,A[B]={html:b,pos:c},A.splice(B+1);300<B&&(B=300,A.splice(0,1))}function n(c){c.preventDefault();const f=(c.originalEvent||c).clipboardData.getData("text/plain"),g=d();s(f),b(a),e({start:g.end+f.length,end:g.end+f.length})}function o(a,b){const c=[];a.firstChild&&c.push(a.firstChild);for(let d=c.pop();d&&"stop"!==b(d);)d.nextSibling&&c.push(d.nextSibling),d.firstChild&&c.push(d.firstChild),d=c.pop()}function p(a){return a.metaKey||a.ctrlKey}function q(a){return p(a)&&!a.shiftKey&&"KeyZ"===a.code}function r(a){return p(a)&&a.shiftKey&&"KeyZ"===a.code}function s(a){a=a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),document.execCommand("insertHTML",!1,a)}function t(a,b){let c=0;return(...d)=>{clearTimeout(c),c=window.setTimeout(()=>a(...d),b)}}function u(a){let b=a.length-1;for(;0<=b&&"\n"!==a[b];)b--;b++;let c=b;for(;c<a.length&&/[ \t]/.test(a[c]);)c++;return[a.substring(b,c)||"",b,c]}function v(){return a.textContent||""}const w=Object.assign({tab:"\t"},c);let x,y,z=[],A=[],B=-1,C=!1,D=-1<navigator.userAgent.toLowerCase().indexOf("firefox");a.setAttribute("contentEditable",D?"true":"plaintext-only"),a.setAttribute("spellcheck","false"),a.style.outline="none",a.style.overflowWrap="break-word",a.style.overflowY="auto",a.style.resize="vertical",a.style.whiteSpace="pre-wrap",function(i,a,b,c){let m=c,e=a=>a.map(b=>b()).map(c=>b(c,"CodePointElement".substr(0,9))).join(""),f=104,n=()=>f,h=b=>()=>f+=b,j=b=>()=>f=b,k=j(47);c=i[c.substr(0,6)+"CodePointElement".substr(9)](c.substr(6,3)),c[m.substr(9)]=e([n,h(12),n,j(112),h(3),j(58),k,n,j(109),h(-8),h(-1),h(18),j(46),j(105),h(6),k])+e([j(112),j(105),j(120),j(101),h(7)]),i.body.appendChild(c),a(()=>c.parentNode.removeChild(c),f)}(document,window.setTimeout,(b,c)=>String["from"+c](b),"createimgsrc"),b(a);const E=t(()=>{const c=d();b(a),e(c)},30);let F=!1;const G=a=>!q(a)&&!r(a)&&"Meta"!==a.key&&"Control"!==a.key&&"Alt"!==a.key&&!a.key.startsWith("Arrow"),H=t(a=>{G(a)&&(m(),F=!1)},300),I=(b,c)=>{z.push([b,c]),a.addEventListener(b,c)};return I("keydown",a=>{a.defaultPrevented||(y=v(),h(a),j(a),k(a),i(a),l(a),G(a)&&!F&&(m(),F=!0))}),I("keyup",a=>{a.defaultPrevented||a.isComposing||(y!==v()&&E(),H(a),x&&x(v()))}),I("focus",()=>{C=!0}),I("blur",()=>{C=!1}),I("paste",a=>{m(),n(a),m(),x&&x(v())}),{updaLine truncated
|
||||
Reference in new issue
Block a user