mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
fix configuration ui
In some cases text is removed, but no new text is pasted.
This commit is contained in:
parent
f7a6b86cae
commit
d30df9dafc
@ -73,10 +73,10 @@ Item {
|
|||||||
"size": plasmoid.configuration.fontSize
|
"size": plasmoid.configuration.fontSize
|
||||||
}
|
}
|
||||||
var font = awActions.getFont(defaultFont)
|
var font = awActions.getFont(defaultFont)
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<span style=\"color:" + font.color +
|
textPattern.insert(textPattern.cursorPosition,
|
||||||
|
"<span style=\"color:" + font.color +
|
||||||
"; font-family:'" + font.family +
|
"; font-family:'" + font.family +
|
||||||
"'; font-size:" + font.size + "pt;\">" +
|
"'; font-size:" + font.size + "pt;\">" +
|
||||||
selected + "</span>")
|
selected + "</span>")
|
||||||
@ -88,10 +88,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Indent button")
|
if (debug) console.debug("Indent button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, selected + "<br>\n")
|
textPattern.insert(textPattern.cursorPosition, selected + "<br>\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,10 +100,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Bold button")
|
if (debug) console.debug("Bold button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<b>" + selected + "</b>")
|
textPattern.insert(textPattern.cursorPosition, "<b>" + selected + "</b>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -113,10 +111,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Italic button")
|
if (debug) console.debug("Italic button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<i>" + selected + "</i>")
|
textPattern.insert(textPattern.cursorPosition, "<i>" + selected + "</i>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -125,10 +122,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Underline button")
|
if (debug) console.debug("Underline button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<u>" + selected + "</u>")
|
textPattern.insert(textPattern.cursorPosition, "<u>" + selected + "</u>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -137,10 +133,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Strike button")
|
if (debug) console.debug("Strike button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<s>" + selected + "</s>")
|
textPattern.insert(textPattern.cursorPosition, "<s>" + selected + "</s>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,10 +145,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Left button")
|
if (debug) console.debug("Left button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p>")
|
textPattern.insert(textPattern.cursorPosition, "<p align=\"left\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -162,10 +156,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Center button")
|
if (debug) console.debug("Center button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p>")
|
textPattern.insert(textPattern.cursorPosition, "<p align=\"center\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -174,10 +167,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Right button")
|
if (debug) console.debug("Right button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p>")
|
textPattern.insert(textPattern.cursorPosition, "<p align=\"right\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -186,10 +178,9 @@ Item {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (debug) console.debug("Justify button")
|
if (debug) console.debug("Justify button")
|
||||||
var pos = textPattern.cursorPosition
|
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p>")
|
textPattern.insert(textPattern.cursorPosition, "<p align=\"justify\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user