Skip to content

Commit

Permalink
Merge pull request #122 from lcnetdev/paste-interlace
Browse files Browse the repository at this point in the history
Copy/Paste Updates
  • Loading branch information
f-osorio authored Nov 8, 2024
2 parents d396060 + 214dcf8 commit 78047bc
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 55 deletions.
4 changes: 2 additions & 2 deletions src/components/panels/edit/fields/helpers/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@
const incomingValue = await blob.text()
const incomingData = JSON.parse(incomingValue)
//need to go through the incoming data and update the guid's
// need a way to match the incoming data to the structure -- propertyURI?
structure.userValue = incomingData.userValue
structure.userModified = true
this.profileStore.dataChanged()
}
Expand Down
10 changes: 5 additions & 5 deletions src/components/panels/edit/modals/SubjectEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,6 @@ methods: {
*/
buildComponents: function(searchString){
let subjectStringSplit = searchString.split('--')
let targetIndex = []
let componentLookUpCount = Object.keys(this.componetLookup).length
Expand All @@ -929,8 +928,9 @@ methods: {
let target = false
for (let i in this.componetLookup){
for (let j in this.componetLookup[i]) {
if (this.componetLookup[i][j].label.includes("--")){
target = this.componetLookup[i][j].label.replaceAll("-", "")
target = this.componetLookup[i][j].label.replaceAll("--", "")
targetIndex = i // needs this to ensure the target will go into the search string in the right place
}
Expand Down Expand Up @@ -2527,7 +2527,7 @@ methods: {
this.linkModeString=linkModeValue
this.subjectString=completeLabel
this.subjectStringChanged()
this.updateAvctiveTypeSelected()
Expand Down Expand Up @@ -2574,13 +2574,13 @@ updated: function() {
incomingSubjects = false
}
}
//When there is existing data, we need to make sure that the number of components matches
// the number subjects in the searchValue
if (this.searchValue && this.components.length != this.searchValue.split("--") && !this.searchValue.endsWith('-')){
this.buildLookupComponents(incomingSubjects)
this.buildComponents(this.searchValue)
this.initialLoad = false
this.subjectStringChanged()
this.activeComponentIndex = 0
Expand Down
60 changes: 30 additions & 30 deletions src/components/panels/nav/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,27 +139,6 @@
click: () => { this.profileStore.createSecondaryInstance() }
}
)
menuButtonSubMenu.push({ is: 'separator'})
menuButtonSubMenu.push(
{
text: 'Copy Mode [' + (this.preferenceStore.copyMode ? "on" : "off") + ']',
click: () => { this.preferenceStore.toggleCopyMode() },
icon: this.preferenceStore.copyMode ? "content_copy" : "block"
}
)
menuButtonSubMenu.push(
{
text: "Paste Content",
icon: "content_paste",
click: () => {
this.$nextTick(()=>{
this.profileStore.pasteSelected()
})
}
}
)
}
if (!this.disable.includes('Menu')){
Expand All @@ -173,12 +152,11 @@
if (!this.disable.includes('Tools')){
menu.push(
{ text: "Tools", menu: [
{ text: "Tools",
menu: [
{ text: "Shelf Listing Browser", click: () => {
this.activeShelfListData = {}
this.showShelfListingModal = true
}, icon:"🗄️" },
{ is: 'separator'},
Expand All @@ -191,11 +169,23 @@
text: "Non-Latin Agents",
// active: this.happy,
click: () => { this.showNonLatinAgentModal = true }
}
},
{ is: 'separator'},
{
text: 'Copy Mode [' + (this.preferenceStore.copyMode ? "on" : "off") + ']',
click: () => { this.preferenceStore.toggleCopyMode() },
icon: this.preferenceStore.copyMode ? "content_copy" : "block"
},
{
text: "Paste Content",
icon: "content_paste",
click: () => {
this.$nextTick(()=>{
this.profileStore.pasteSelected()
})
}
}
] }
)
Expand Down Expand Up @@ -359,9 +349,19 @@
}
}
)
}
menu.push(
{
text: "Paste Content",
icon: "content_paste",
click: () => {
this.$nextTick(()=>{
this.profileStore.pasteSelected()
})
}
}
)
if (this.preferenceStore.copyMode){
menu.push(
{
text: !this.allSelected ? "Select All" : "Deselect All",
Expand Down
2 changes: 1 addition & 1 deletion src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const useConfigStore = defineStore('config', {

versionMajor: 0,
versionMinor: 16,
versionPatch: 5,
versionPatch: 6,



Expand Down
35 changes: 18 additions & 17 deletions src/stores/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,6 @@ export const useProfileStore = defineStore('profile', {
*/
marcPreview: async function(){
let xml = await utilsExport.buildXML(this.activeProfile)

let preview = null
if (!usePreferenceStore().returnValue('--b-edit-main-splitpane-opac-marc-html')){
preview = await utilsNetwork.marcPreview(xml.bf2Marc, false)
Expand Down Expand Up @@ -3648,8 +3647,7 @@ export const useProfileStore = defineStore('profile', {
lastPosition = idx
}
}



if (propertyPosition != -1 && (r.includes(actionTarget) || actionTarget == null)){
profile = r
break
Expand Down Expand Up @@ -3690,9 +3688,6 @@ export const useProfileStore = defineStore('profile', {
]
}




// we also want to add any default values in if it is just a empty new property and not duping
let idPropertyId = newPt.propertyURI
let baseURI = newPt.propertyURI
Expand All @@ -3719,7 +3714,7 @@ export const useProfileStore = defineStore('profile', {
}

this.activeProfile.rt[profile].pt[newPropertyId] = JSON.parse(JSON.stringify(newPt))
this.activeProfile.rt[profile].ptOrder.splice(Number(lastPosition)+1, 0, newPropertyId);
this.activeProfile.rt[profile].ptOrder.splice(Number(propertyPosition)+1, 0, newPropertyId);


if (structure){
Expand Down Expand Up @@ -4194,19 +4189,24 @@ export const useProfileStore = defineStore('profile', {

//loop through the copied data and change all the "@guid"s
changeGuid: function(data){
for (let key of Object.keys(data)){
if (key == "@guid"){
data[key] = short.generate()
} else if(Array.isArray(data[key])) {
this.changeGuid(data[key])
} else if (typeof data[key] == "object"){
this.changeGuid(data[key])
try{
for (let key of Object.keys(data)){
if (key == "@guid"){
data[key] = short.generate()
} else if(Array.isArray(data[key])) {
this.changeGuid(data[key])
} else if (typeof data[key] == "object"){
this.changeGuid(data[key])
}
}
} catch {

}
},

//parse the activeProfile and insert the copied data where appropriate
parseActiveInsert: async function(newComponent){
const matchGuid = newComponent["@guid"]
this.changeGuid(newComponent)
let profile = this.activeProfile

Expand All @@ -4228,9 +4228,10 @@ export const useProfileStore = defineStore('profile', {
break
} else {
let guid = current["@guid"]
let structure = this.returnStructureByComponentGuid(guid)
let newPt = await this.duplicateComponentGetId(guid, structure)

let structure = this.returnStructureByComponentGuid(matchGuid)
let newPt = await this.duplicateComponentGetId(matchGuid, structure)

profile["rt"][rt]["pt"][newPt].userModified = true
profile["rt"][rt]["pt"][newPt].userValue = newComponent.userValue
break
}
Expand Down

0 comments on commit 78047bc

Please sign in to comment.