__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import { CodeMirror } from "./CodeMirror.js"
import { activeElt } from "../util/dom.js"
import { off, on } from "../util/event.js"
import { copyObj } from "../util/misc.js"
export function fromTextArea(textarea, options) {
options = options ? copyObj(options) : {}
options.value = textarea.value
if (!options.tabindex && textarea.tabIndex)
options.tabindex = textarea.tabIndex
if (!options.placeholder && textarea.placeholder)
options.placeholder = textarea.placeholder
// Set autofocus to true if this textarea is focused, or if it has
// autofocus and no other element is focused.
if (options.autofocus == null) {
let hasFocus = activeElt()
options.autofocus = hasFocus == textarea ||
textarea.getAttribute("autofocus") != null && hasFocus == document.body
}
function save() {textarea.value = cm.getValue()}
let realSubmit
if (textarea.form) {
on(textarea.form, "submit", save)
// Deplorable hack to make the submit method do the right thing.
if (!options.leaveSubmitMethodAlone) {
let form = textarea.form
realSubmit = form.submit
try {
let wrappedSubmit = form.submit = () => {
save()
form.submit = realSubmit
form.submit()
form.submit = wrappedSubmit
}
} catch(e) {}
}
}
options.finishInit = cm => {
cm.save = save
cm.getTextArea = () => textarea
cm.toTextArea = () => {
cm.toTextArea = isNaN // Prevent this from being ran twice
save()
textarea.parentNode.removeChild(cm.getWrapperElement())
textarea.style.display = ""
if (textarea.form) {
off(textarea.form, "submit", save)
if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
textarea.form.submit = realSubmit
}
}
}
textarea.style.display = "none"
let cm = CodeMirror(node => textarea.parentNode.insertBefore(node, textarea.nextSibling),
options)
return cm
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| CodeMirror.js | File | 8.42 KB | 0644 |
|
| commands.js | File | 7.33 KB | 0644 |
|
| deleteNearSelection.js | File | 1.03 KB | 0644 |
|
| drop_events.js | File | 5.01 KB | 0644 |
|
| fromTextArea.js | File | 1.94 KB | 0644 |
|
| global_events.js | File | 1.41 KB | 0644 |
|
| key_events.js | File | 5.38 KB | 0644 |
|
| legacy.js | File | 2.52 KB | 0644 |
|
| main.js | File | 2.02 KB | 0644 |
|
| methods.js | File | 21.72 KB | 0644 |
|
| mouse_events.js | File | 15.6 KB | 0644 |
|
| options.js | File | 7.06 KB | 0644 |
|
| utils.js | File | 270 B | 0644 |
|