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

Migrate icons to vue material design icons #2439

Merged
merged 67 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
fab8ffd
🚧 (#2345): use material design icons
May 13, 2022
8828cc8
♻️ (#2345) split menu bar in small components
May 17, 2022
a5fe788
⚰️ (#2345): remove unused methods and codes
May 17, 2022
49f03c7
🚨 use window.btoa instead of global btoa function
May 17, 2022
5664eed
Merge remote-tracking branch 'origin/master' into 2345-migrate-icons-…
May 17, 2022
3b8aaec
🚚 (#2345): rename components
May 19, 2022
8528429
✨ (#2345): add ActionList
May 20, 2022
7c1884e
🚸 (#2345): add Remaining Actions
May 20, 2022
3f1a006
💄 (#2345): improve fullscreen menu bar
May 21, 2022
29898e4
🐛 (2345): fix hidden condiction
May 23, 2022
5e8f077
💄 (#2345): table icons
May 23, 2022
3903f44
💄 (#2345): add refocus
May 23, 2022
57fd2a2
Merge remote-tracking branch 'origin/master' into 2345-migrate-icons-…
May 23, 2022
d0bff88
⚰️ (#2345): remove unused attribute
May 23, 2022
783bfa0
♻️ (#2345): remove id selectors
May 23, 2022
c7a7723
✅ (#2345): fix share tests
May 23, 2022
6e83554
✅ (#2345): fix viewer tests
May 23, 2022
bf27bd9
✅ (#2345): fix links tests
May 23, 2022
7c07720
🚧 (#2345): workspace tests
May 23, 2022
16a51aa
✏️ (#2345): fix entries key
May 24, 2022
7785ee9
🧑‍💻 (#2345): add data- to table components
May 24, 2022
c9ffd50
✅ (#2345): fix workspace tests
May 24, 2022
f0d478b
Merge remote-tracking branch 'origin/master' into 2345-migrate-icons-…
May 24, 2022
a584247
Compile assets
nextcloud-command May 24, 2022
fcbb841
🚨 (#2345): fix stylelint
May 24, 2022
3c5f060
✏️ (#2345): fix missing/typo data attributes
May 25, 2022
a38a69a
✅ (#2345): fix image tests
May 25, 2022
fbe7f11
🐛 (#2345): fix upload state reactivity
May 25, 2022
13e2a0d
🚸 (#2345): use 20px as default size for all icons
May 25, 2022
bf8f930
♻️ (#2345): small adjust
May 25, 2022
b309fb3
⚰️ (#2345): remove unused component
May 25, 2022
be79048
Compile assets
nextcloud-command May 25, 2022
4df8202
💚 (#2345): fix inconsistent test
May 25, 2022
99f40d3
🚸 (#2345): adjust menubar position
May 26, 2022
bb02c39
🚚 (#2345): rename Menu.vue -> MenuBar.vue
May 26, 2022
12cadee
🚚 (#2345): rename ActionEntry.mixin.js -> BaseActionEntry.js
May 26, 2022
5615e73
Merge remote-tracking branch 'origin/master' into 2345-migrate-icons-…
May 26, 2022
1d699f5
♻️ (#2345): rename _key -> key
May 26, 2022
065f67c
Compile assets
nextcloud-command May 26, 2022
f5429f8
🚚 (#2345): rename EditorDraggable -> EditorMidiaHandler
May 26, 2022
242cc9c
🚸 (#2345): remove menubar flickering
May 26, 2022
11bd79a
🐛 (#2345): fix missing static class
May 26, 2022
46ad510
♻️ (#2345): make Callout as a component
May 26, 2022
0a5eae6
Merge branch '2345-migrate-icons-to-vue-material-design-icons' of git…
May 26, 2022
6ed94da
Compile assets
nextcloud-command May 26, 2022
9dfa141
🐛 (#2345): fix pass through of props
May 26, 2022
ebb5ccd
🐛 (#2345): fix missing event trigged when actionEntry have an click i…
May 26, 2022
bb05046
🐛 (#2345): fix missing help modal
May 26, 2022
db0e5ca
Merge branch '2345-migrate-icons-to-vue-material-design-icons' of git…
May 26, 2022
538d758
Compile assets
nextcloud-command May 26, 2022
b8d9dd1
Merge remote-tracking branch 'origin/master' into 2345-migrate-icons-…
May 27, 2022
acfb264
⚰️ (#2345): remove unused icons
May 27, 2022
07cebb8
Compile assets
nextcloud-command May 27, 2022
956f95a
🩹 (#2345): remove test code
May 27, 2022
d209246
Merge branch '2345-migrate-icons-to-vue-material-design-icons' of git…
May 27, 2022
c99d4cb
Merge remote-tracking branch 'origin/master' into 2345-migrate-icons-…
May 30, 2022
dd7c8aa
🐛 (#2345): fix wrong condiction
May 30, 2022
c6496ff
✏️ (#2345): typofix
May 30, 2022
02f8944
✏️ (#2345): typofix
May 30, 2022
afcc192
Compile assets
nextcloud-command May 30, 2022
3286d1b
🩹 (#2345): improve ActionList component
May 30, 2022
08ef254
🩹 (#2345): prevent error when file is undefined
May 30, 2022
66bdbaf
✨ (#2345): more icons
May 30, 2022
a3a438e
💄 (#2345): use mdi icons in bubble menu
May 30, 2022
4ad919a
🎨 (#2345): sort icons
May 30, 2022
6345231
🩹 (#2345): use nextcloud button instead of html button
May 31, 2022
c22c731
Compile assets
nextcloud-command May 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions css/icons.scss

This file was deleted.

62 changes: 0 additions & 62 deletions css/prosemirror.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,68 +192,6 @@ div.ProseMirror {
margin-right: 0;
}

// Callout Block
.callout {
background-color: var(--callout-background, var(--color-background-hover));
border-left-color: var(--callout-border, var(--color-primary-element));
border-radius: var(--border-radius);
padding: 1em;
padding-left: 2em;
border-left-width: 0.3em;
border-left-style: solid;
position: relative;
margin-bottom: 0.5em;
+ & {
margin-top: 0.5em;
}

// Block icon
&::before {
content: '';
background-image: var(--callout-icon, var(--icon-info-000));
background-size: contain;
position: absolute;
top: calc(50% - 8px);
left: 0.4em;
height: 16px;
width: 16px;
}

> p {
&:last-child {
margin-bottom: 0;
}
}

// Info (default) variables
&, &-info {
// --callout-background: var(--color-primary-light);
--callout-border: var(--color-primary-element);
--callout-icon: var(--icon-info-000);
}

// Warn variables
&-warn {
// --callout-background: var(--color-warning-hover);
--callout-border: var(--color-warning);
--callout-icon: var(--icon-text-warn-000);
}

// Error variables
&-error {
// --callout-background: var(--color-error-hover);
--callout-border: var(--color-error);
--callout-icon: var(--icon-error-000);
}

// Success variables
&-success {
// --callout-background: var(--color-success-hover);
--callout-border: var(--color-success);
--callout-icon: var(--icon-text-success-000);
}
}

// table variables
@at-root :root {
--table-color-border: var(--color-border);
Expand Down
21 changes: 21 additions & 0 deletions css/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
:root {
--text-editor-max-width: 670px
}

.modal-container #editor-container {
position: absolute;
}
Expand Down Expand Up @@ -52,3 +56,20 @@ li.ProseMirror-selectednode:after {
visibility: hidden;
}
}

.animation-rotate {
animation: rotate var(--animation-duration, 0.8s) linear infinite;
}

// from https://github.com/animate-css/animate.css/blob/main/source/fading_entrances/fadeInDown.css
@keyframes fadeInDown {
from {
opacity: 0;
transform: translate3d(0, -100%, 0);
}

to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
102 changes: 51 additions & 51 deletions cypress/integration/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,22 @@ const randUser2 = randHash()
let currentUser = randUser
const attachmentFileNameToId = {}

const ACTION_UPLOAD_LOCAL_FILE = 1
const ACTION_INSERT_FROM_FILES = 2
const ACTION_INSERT_FROM_LINK = 3
const ACTION_UPLOAD_LOCAL_FILE = 'insert-image-upload'
const ACTION_INSERT_FROM_FILES = 'insert-image-insert'
// const ACTION_INSERT_FROM_LINK = 3

/**
* @param {string} name name of file
* @param {string|null} requestAlias alias name
*/
function attachFile(name, requestAlias = null) {
if (requestAlias) {
cy.intercept({ method: 'POST', url: '**/upload' }).as(requestAlias)
}
return cy.getEditor()
.find('input[type="file"][data-text-el="image-file-input"]')
.attachFile(name)
}

/**
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
Expand All @@ -45,27 +58,15 @@ function fixedEncodeURIComponent(str) {
/**
* Open the image action menu and click one action
*
* @param actionIndex position of the action to be clicked
* @param callback what happens once it's been clicked
* @param actionName position of the action to be clicked
*/
const clickOnImageAction = (actionIndex, callback) => {
cy.get('#viewer .action-item.submenu')
.should('not.have.class', 'action-item--open')
const clickOnImageAction = (actionName) => {
cy.getActionEntry('insert-image')
.click()

return cy.get('.popover.open')
.getActionEntry(actionName)
.click()
.should('have.class', 'action-item--open')

// get the popover ID to be able to find the related DOM element
return cy.get('#viewer .action-item.submenu > div.v-popover > .trigger')
.should('have.attr', 'aria-describedby')
.should('contain', 'popover_')
.then((popoverId) => {
cy.log('Click on the action entry')
cy.get('div#' + popoverId)
.should('have.class', 'open')
.find('li:nth-child(' + actionIndex + ')').click()
// our job here is done
callback(popoverId)
})
}

/**
Expand Down Expand Up @@ -120,17 +121,15 @@ const checkImage = (documentId, imageName, imageId, index) => {
* @param {number|undefined} index of image
*/
const waitForRequestAndCheckImage = (requestAlias, index) => {
return new Cypress.Promise((resolve, reject) => {
return cy.wait('@' + requestAlias).then((req) => {
return cy.wait('@' + requestAlias)
.then((req) => {
// the name of the created file on NC side is returned in the response
const fileId = req.response.body.id
const fileName = req.response.body.name
const documentId = req.response.body.documentId

checkImage(documentId, fileName, fileId, index)
.then(resolve, reject)
return checkImage(documentId, fileName, fileId, index)
})
})
}

describe('Test all image insertion methods', () => {
Expand Down Expand Up @@ -168,49 +167,50 @@ describe('Test all image insertion methods', () => {

it('Insert an image from files', () => {
cy.openFile('test.md')
clickOnImageAction(ACTION_INSERT_FROM_FILES, () => {
const requestAlias = 'insertPathRequest'
cy.intercept({ method: 'POST', url: '**/filepath' }).as(requestAlias)
clickOnImageAction(ACTION_INSERT_FROM_FILES)
.then(() => {
const requestAlias = 'insertPathRequest'
cy.intercept({ method: 'POST', url: '**/filepath' }).as(requestAlias)

cy.log('Select the file in the filepicker')
cy.get('#picker-filestable tr[data-entryname="github.png"]').click()
cy.log('Click OK in the filepicker')
cy.get('.oc-dialog > .oc-dialog-buttonrow button').click()
cy.log('Select the file in the filepicker')
cy.get('#picker-filestable tr[data-entryname="github.png"]').click()
cy.log('Click OK in the filepicker')
cy.get('.oc-dialog > .oc-dialog-buttonrow button').click()

waitForRequestAndCheckImage(requestAlias)
})
waitForRequestAndCheckImage(requestAlias)
})
})

it('Upload a local image', () => {
cy.openFile('test.md')
// in this case we almost could just attach the file to the input
// BUT we still need to click on the action because otherwise the command
// is not handled correctly when the upload has been done in <MenuBar>
clickOnImageAction(ACTION_UPLOAD_LOCAL_FILE, () => {
const requestAlias = 'uploadRequest'
cy.intercept({ method: 'POST', url: '**/upload' }).as(requestAlias)
clickOnImageAction(ACTION_UPLOAD_LOCAL_FILE)
.then(() => {
const requestAlias = 'uploadRequest'
cy.log('Upload the file through the input')

cy.log('Upload the file through the input')
cy.get('.menubar input[type="file"]').attachFile('table.png')
attachFile('table.png', requestAlias)

waitForRequestAndCheckImage(requestAlias)
})
return waitForRequestAndCheckImage(requestAlias)
})
})

it('Upload images with the same name', () => {
cy.uploadFile('empty.md', 'text/markdown')
cy.openFile('empty.md')

const assertImage = index => {
return clickOnImageAction(ACTION_UPLOAD_LOCAL_FILE, () => {
const requestAlias = `uploadRequest${index}`
cy.intercept({ method: 'POST', url: '**/upload' }).as(requestAlias)
return clickOnImageAction(ACTION_UPLOAD_LOCAL_FILE)
.then(() => {
const requestAlias = `uploadRequest${index}`
cy.log('Upload the file through the input', { index })

cy.log('Upload the file through the input', { index })
cy.get('.menubar input[type="file"]').attachFile('github.png')
attachFile('github.png', requestAlias)

return waitForRequestAndCheckImage(requestAlias, index)
})
return waitForRequestAndCheckImage(requestAlias, index)
})
}

cy.wrap([0, 1, 2])
Expand All @@ -220,7 +220,7 @@ describe('Test all image insertion methods', () => {
})
})
.then(() => {
return cy.get('#editor [data-component="image-view"]')
return cy.getEditor().find('[data-component="image-view"]')
.should('have.length', 3)
})
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { randHash } from '../utils/'
const randUser = randHash()
const fileName = 'empty.md'

const getEditor = () => cy.get('#viewer #editor .ProseMirror')
const getEditor = () => cy.getEditor().find('.ProseMirror')

const clearContent = () => getEditor()
.type('{selectall}')
Expand Down
Loading