fix: allow copying locked note's title (#557)

* fix: allow copying locked note's title

* chore: version bump
This commit is contained in:
Vardan Hakobyan
2022-02-24 18:33:41 +04:00
committed by GitHub
parent 1a2b66042c
commit f6fa6ce4b0
2 changed files with 11 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "standardnotes-mobile",
"version": "3.12.0",
"user-version": "3.12.0",
"version": "3.12.1",
"user-version": "3.12.1",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {

View File

@@ -3,6 +3,7 @@ import { ComponentLoadingError } from '@Lib/component_manager';
import { isNullOrUndefined } from '@Lib/utils';
import { ApplicationContext } from '@Root/ApplicationContext';
import { SCREEN_COMPOSE } from '@Screens/screens';
import SNTextView from '@standardnotes/react-native-textview';
import {
ApplicationEvent,
ComponentMutator,
@@ -21,7 +22,6 @@ import { lighten } from '@Style/utils';
import React, { createRef } from 'react';
import { Keyboard, Platform, View } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import SNTextView from '@standardnotes/react-native-textview';
import { ThemeContext } from 'styled-components';
import { ComponentView } from './ComponentView';
import {
@@ -53,6 +53,9 @@ type State = {
componentViewer?: ComponentViewer;
};
const EditingIsDisabledText =
'This note has editing disabled. Please enable editing on this note to make changes.';
export class Compose extends React.Component<{}, State> {
static contextType = ApplicationContext;
context: React.ContextType<typeof ApplicationContext>;
@@ -412,6 +415,10 @@ export class Compose extends React.Component<{}, State> {
};
onTitleChange = (newTitle: string) => {
if (this.note?.locked) {
this.context?.alertService?.alert(EditingIsDisabledText);
return;
}
this.setState(
{
title: newTitle,
@@ -422,9 +429,7 @@ export class Compose extends React.Component<{}, State> {
onContentChange = (text: string) => {
if (this.note?.locked) {
this.context?.alertService?.alert(
'This note has editing disabled. Please enable editing on this note to make changes.'
);
this.context?.alertService?.alert(EditingIsDisabledText);
return;
}
this.saveNote(false, true, false, false, text);
@@ -556,7 +561,6 @@ export class Compose extends React.Component<{}, State> {
keyboardAppearance={themeService?.keyboardColorForActiveTheme()}
autoCorrect={true}
autoCapitalize={'sentences'}
editable={!this.noteLocked}
/>
{(this.state.downloadingEditor ||
(this.state.loadingWebview &&