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

Select all button of <syntaxhighlight lang=lua line> includes line number in text #27

Open
ProditorMagnus opened this issue Aug 8, 2024 · 3 comments

Comments

@ProditorMagnus
Copy link

ProditorMagnus commented Aug 8, 2024

https://wiki.wesnoth.org/Sandbox/GUI/Getting_Started#Building_a_Tree uses <syntaxhighlight lang=lua line>, and clicking it selects

  1local function basic_tree_view()
  2    local tree_view = wml.tag.tree_view {
  3        id = "monsters_tv",
  4   ...

Expected behaviour would be excluding line numbers. Proof of concept solution (chrome):

$(".cb-icon").click(function(event) {
	var e = $(this).parents(".codebox").children("pre")[0];

	let textResult = "";
	for (node of e.childNodes){
		if(typeof node.getAttribute !== "function" || node.getAttribute("class") !== "linenos"){
			let currentText = node.innerText || node.nodeValue;
			if (currentText) {
				textResult += currentText;
			}
		}
	}
	navigator.clipboard.writeText(textResult);
});
@soliton-
Copy link
Member

I do not get line numbers in the copied text in either chrome, firefox or safari.

@ProditorMagnus
Copy link
Author

I believe @CelticMinstrel fixed it soon after I reported it

@CelticMinstrel
Copy link
Member

I fixed it by editing the Common.css page on the wiki. There might be a better fix in the style itself.

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

3 participants