Fixed the song textarea from removing blank lines

This commit is contained in:
Chris Cochrun 2022-03-23 14:46:28 -05:00
parent 7f69726c47
commit 93c94e19db
7 changed files with 51 additions and 8 deletions

View file

@ -38,7 +38,8 @@ ColumnLayout {
dragItemType,
dragItemText,
dragItemBackgroundType,
dragItemBackground);
dragItemBackground,
dragItemIndex);
}
keys: ["library"]
@ -126,7 +127,8 @@ ColumnLayout {
dragItemType,
dragItemText,
dragItemBackgroundType,
dragItemBackground);
dragItemBackground,
dragItemIndex);
}
keys: ["library"]
}
@ -173,7 +175,7 @@ ColumnLayout {
}
}
function addItem(index, name, type, text, backgroundType, background) {
function addItem(index, name, type, text, backgroundType, background, itemID) {
serviceListModel.insert(index, {
"name": name,
"type": type,
@ -182,13 +184,19 @@ ColumnLayout {
"background": background})
}
function appendItem(name, type, text, backgroundType, background) {
function appendItem(name, type, text, backgroundType, background, itemID) {
serviceListModel.append({
"name": name,
"type": type,
"text": text,
"backgroundType": backgroundType,
"background": background})
"background": background});
if (type == "song") {
const lyrics = songsqlmodel.getLyricList(itemID);
print(lyrics);
}
}
}

View file

@ -208,6 +208,7 @@ Item {
target: songListItem
onActiveChanged: {
if (songDragHandler.drag.active) {
dragItemIndex = index;
dragItemTitle = title;
dragItemType = "song";
dragItemBackgroundType = backgroundType;

View file

@ -18,6 +18,7 @@ Controls.Page {
/* property var video */
property int dragItemIndex
property string dragItemTitle: ""
property string dragItemType: ""
property string dragItemText: ""

View file

@ -177,13 +177,14 @@ Item {
placeholderText: "Put lyrics here..."
persistentSelection: true
text: songLyrics
textFormat: TextEdit.MarkdownText
textFormat: TextEdit.PlainText
padding: 10
onEditingFinished: {
updateLyrics(text);
updateLyrics(lyricsEditor.getText(0,lyricsEditor.length));
editorTimer.running = false;
}
onPressed: editorTimer.running = true
/* Component.onCompleted: text = songsqlmodel.getLyrics(songIndex); */
}
}
Controls.TextField {
@ -215,6 +216,12 @@ Item {
Layout.rightMargin: 20
Layout.leftMargin: 20
}
Controls.Button {
text: "update lyrics"
onClicked: {
print(lyricsEditor.getText(0,lyricsEditor.length));
}
}
}
}
}
@ -224,7 +231,9 @@ Item {
interval: 1000
repeat: true
running: false
onTriggered: updateLyrics(lyricsEditor.text)
onTriggered: {
updateLyrics(lyricsEditor.getText(0,lyricsEditor.length));
}
}
FileDialog {
@ -282,6 +291,7 @@ Item {
function updateLyrics(lyrics) {
songsqlmodel.updateLyrics(songIndex, lyrics);
print(lyrics);
}
function updateTitle(title) {