Skip to content

Commit

Permalink
generate a random id when an id attribute is added
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsboost committed Sep 1, 2024
1 parent 5854ece commit dc20a6a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Free Mobile Website Builder! Create awesome responsive websites. Easy and fast -
![](https://raw.githubusercontent.com/michaelsboost/Polyrise/gh-pages/imgs/header.png)

### Version
1.0.1
1.0.2

### Tech

Expand Down
2 changes: 1 addition & 1 deletion dist/App.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/App.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/App-backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ let app = {
href: 'https://michaelsboost.com/',
src: 'imgs/author.jpg'
},
version: '1.0.1',
version: '1.0.2',
url: 'https://github.com/michaelsboost/Polyrise/',
license: 'https://github.com/michaelsboost/Polyrise/blob/gh-pages/LICENSE'
}
Expand Down Expand Up @@ -1734,7 +1734,8 @@ window.addAttribute = attr => {
// Iterate over each attribute and add it if it doesn't exist
saveState();
attrs.forEach(attribute => {
const [key, value] = attribute.split('=').map(s => s.trim());
let [key, value] = attribute.split('=').map(s => s.trim());
if (key === 'id') value = generateId();

if (!(key in layer.props)) {
layer.props[key] = value !== undefined ? value : "";
Expand All @@ -1746,7 +1747,6 @@ window.addAttribute = attr => {
saveState();
}
});
document.querySelector('dialog[open]').querySelector('header > button').onclick();
}
function LayerTree() {
// Function to render each layer recursively
Expand Down
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ let app = {
href: 'https://michaelsboost.com/',
src: 'imgs/author.jpg'
},
version: '1.0.1',
version: '1.0.2',
url: 'https://github.com/michaelsboost/Polyrise/',
license: 'https://github.com/michaelsboost/Polyrise/blob/gh-pages/LICENSE'
}
Expand Down Expand Up @@ -1734,7 +1734,8 @@ window.addAttribute = attr => {
// Iterate over each attribute and add it if it doesn't exist
saveState();
attrs.forEach(attribute => {
const [key, value] = attribute.split('=').map(s => s.trim());
let [key, value] = attribute.split('=').map(s => s.trim());
if (key === 'id') value = generateId();

if (!(key in layer.props)) {
layer.props[key] = value !== undefined ? value : "";
Expand All @@ -1746,7 +1747,6 @@ window.addAttribute = attr => {
saveState();
}
});
document.querySelector('dialog[open]').querySelector('header > button').onclick();
}
function LayerTree() {
// Function to render each layer recursively
Expand Down

0 comments on commit dc20a6a

Please sign in to comment.