Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我想自定义添加一个div . 可是添加不进去。div 无法展示,只能显示p标签 #212

Open
wenjing0628 opened this issue Aug 13, 2024 · 1 comment

Comments

@wenjing0628
Copy link

MU.insertDiv = function(string,alt) {
const div = _inserDivAtSelection(string, alt);

_callbackInput();
return div;

}
const _inserDivAtSelection = function(string, alt, dimensions) {
const sel = document.getSelection();
const range = sel.getRangeAt(0);
const div = document.createElement('div');
range.insertNode(div);
var newContent = document.createTextNode(string);
div.appendChild(newContent);
return div;
};

@stevengharris
Copy link
Owner

What is the issue? The MU.insertDiv functionality was added as part of the work on #178. There is an minor SwiftUI demo of it in SwiftUIDemo/DivsContentView.swift, but there isn't any documentation of how to use it beyond the code in this demo. Unless you are working on a project that needs to have multiple contenteditable divs within a single document, then this is probably not something you are going to want to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants