mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 07:01:31 +08:00 
			
		
		
		
	Merge branch 'stable'
# Conflicts: # src/public/app/widgets/toc.js
This commit is contained in:
		
						commit
						f3bc604516
					
				@ -226,6 +226,10 @@ class NoteContext extends Component {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this.viewScope.viewMode === 'source') {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const noteComplement = await this.getNoteComplement();
 | 
			
		||||
 | 
			
		||||
        const sizeLimit = this.note.type === 'text'
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,9 @@ import protectedSessionHolder from "../../services/protected_session_holder.js";
 | 
			
		||||
 | 
			
		||||
export default class EditButton extends OnClickButtonWidget {
 | 
			
		||||
    isEnabled() {
 | 
			
		||||
        return super.isEnabled() && this.note;
 | 
			
		||||
        return super.isEnabled()
 | 
			
		||||
            && this.note
 | 
			
		||||
            && this.noteContext.viewScope.viewMode === 'default';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    constructor() {
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,8 @@ export default class TocWidget extends RightPanelWidget {
 | 
			
		||||
    isEnabled() {
 | 
			
		||||
        return super.isEnabled()
 | 
			
		||||
            && this.note.type === 'text'
 | 
			
		||||
            && !this.noteContext.viewScope.tocTemporarilyHidden;
 | 
			
		||||
            && !this.noteContext.viewScope.tocTemporarilyHidden
 | 
			
		||||
            && this.noteContext.viewScope.viewMode === 'default';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async doRenderBody() {
 | 
			
		||||
@ -176,9 +177,7 @@ export default class TocWidget extends RightPanelWidget {
 | 
			
		||||
            const headingElement = $container.find(":header")[headingIndex];
 | 
			
		||||
 | 
			
		||||
            if (headingElement != null) {
 | 
			
		||||
                headingElement.scrollIntoView({
 | 
			
		||||
                    behavior: 'smooth'
 | 
			
		||||
                });
 | 
			
		||||
                headingElement.scrollIntoView({ behavior: "smooth" });
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            const textEditor = await this.noteContext.getTextEditor();
 | 
			
		||||
@ -263,4 +262,4 @@ class CloseTocButton extends OnClickButtonWidget {
 | 
			
		||||
            })
 | 
			
		||||
            .class("icon-action close-toc");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,14 @@ const TPL = `
 | 
			
		||||
        .excalidraw .App-menu_top .buttonList {
 | 
			
		||||
            display: flex;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        /* Conflict between excalidraw and bootstrap classes keeps the menu hidden */
 | 
			
		||||
        /* https://github.com/zadam/trilium/issues/3780 */
 | 
			
		||||
        /* https://github.com/excalidraw/excalidraw/issues/6567 */
 | 
			
		||||
        .excalidraw .dropdown-menu {
 | 
			
		||||
            display: block;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        .excalidraw-wrapper {
 | 
			
		||||
            height: 100%;
 | 
			
		||||
 | 
			
		||||
@ -48,7 +48,7 @@ export default class ImageOptions extends OptionsWidget {
 | 
			
		||||
            this.updateOption('imageMaxWidthHeight', this.$imageMaxWidthHeight.val()));
 | 
			
		||||
 | 
			
		||||
        this.$imageJpegQuality.on('change', () =>
 | 
			
		||||
            this.updateOption('imageJpegQuality', this.$imageJpegQuality.val()));
 | 
			
		||||
            this.updateOption('imageJpegQuality', this.$imageJpegQuality.val().trim() || "75"));
 | 
			
		||||
 | 
			
		||||
        this.$downloadImagesAutomatically = this.$widget.find(".download-images-automatically");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -110,8 +110,8 @@ function checkCredentials(req, res, next) {
 | 
			
		||||
 | 
			
		||||
    const header = req.headers['trilium-cred'] || '';
 | 
			
		||||
    const auth = new Buffer.from(header, 'base64').toString();
 | 
			
		||||
    const [username, password] = auth.split(/:/);
 | 
			
		||||
 | 
			
		||||
    const colonIndex = auth.indexOf(':');
 | 
			
		||||
    const password = colonIndex === -1 ? "" : auth.substr(colonIndex + 1);
 | 
			
		||||
    // username is ignored
 | 
			
		||||
 | 
			
		||||
    if (!passwordEncryptionService.verifyPassword(password)) {
 | 
			
		||||
 | 
			
		||||
@ -134,7 +134,7 @@ function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSwitch,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function shrinkImage(buffer, originalName) {
 | 
			
		||||
    let jpegQuality = optionService.getOptionInt('imageJpegQuality');
 | 
			
		||||
    let jpegQuality = optionService.getOptionInt('imageJpegQuality', 0);
 | 
			
		||||
 | 
			
		||||
    if (jpegQuality < 10 || jpegQuality > 100) {
 | 
			
		||||
        jpegQuality = 75;
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ function getOptionOrNull(name) {
 | 
			
		||||
        // e.g. in initial sync becca is not loaded because DB is not initialized
 | 
			
		||||
        option = sql.getRow("SELECT * FROM options WHERE name = ?", name);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    return option ? option.value : null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -27,13 +27,17 @@ function getOption(name) {
 | 
			
		||||
/**
 | 
			
		||||
 * @returns {number}
 | 
			
		||||
 */
 | 
			
		||||
function getOptionInt(name) {
 | 
			
		||||
function getOptionInt(name, defaultValue = undefined) {
 | 
			
		||||
    const val = getOption(name);
 | 
			
		||||
 | 
			
		||||
    const intVal = parseInt(val);
 | 
			
		||||
 | 
			
		||||
    if (isNaN(intVal)) {
 | 
			
		||||
        throw new Error(`Could not parse "${val}" into integer for option "${name}"`);
 | 
			
		||||
        if (defaultValue === undefined) {
 | 
			
		||||
            throw new Error(`Could not parse "${val}" into integer for option "${name}"`);
 | 
			
		||||
        } else {
 | 
			
		||||
            return defaultValue;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return intVal;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user