mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
3ea7cd520f
commit
c4c3d880a1
1 changed files with 6 additions and 7 deletions
|
|
@ -967,10 +967,10 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
const iframeElement = nodeElement.querySelector("iframe");
|
||||
let html = nodeElement.outerHTML;
|
||||
const subMenus: IMenu[] = [{
|
||||
label: `<div class="fn__hr--small"></div><input style="margin: 4px 0" class="b3-text-field fn__size200" value="${iframeElement.getAttribute("src") || ""}" placeholder="${window.siyuan.languages.link}"><div class="fn__hr--small"></div>`,
|
||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.link}">${iframeElement.getAttribute("src") || ""}</textarea><div class="fn__hr--small"></div>`,
|
||||
bind(element) {
|
||||
element.querySelector("input").addEventListener("change", (event) => {
|
||||
const value = (event.target as HTMLInputElement).value;
|
||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||
const value = (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "");
|
||||
const biliMatch = value.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/);
|
||||
if (value.indexOf("bilibili.com") > -1 && (value.indexOf("bvid=") > -1 || (biliMatch && biliMatch[1]))) {
|
||||
const params: IObject = {
|
||||
|
|
@ -1031,11 +1031,10 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
|
|||
const videoElement = nodeElement.querySelector(type === "NodeVideo" ? "video" : "audio");
|
||||
let html = nodeElement.outerHTML;
|
||||
const subMenus: IMenu[] = [{
|
||||
label: `<input style="margin: 4px 0" class="b3-text-field" value="${videoElement.getAttribute("src")}" placeholder="${window.siyuan.languages.link}">`,
|
||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field" placeholder="${window.siyuan.languages.link}">${videoElement.getAttribute("src")}</textarea><div class="fn__hr--small"></div>`,
|
||||
bind(element) {
|
||||
element.querySelector("input").addEventListener("change", (event) => {
|
||||
const value = (event.target as HTMLInputElement).value;
|
||||
videoElement.setAttribute("src", value);
|
||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||
videoElement.setAttribute("src", (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
|
||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||
html = nodeElement.outerHTML;
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue