mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-31 19:19:34 +02:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a101dbdf31 | ||
|
|
682609044f | ||
|
|
c0a7fb3a5c | ||
|
|
a153aa791c | ||
|
|
76b3dd1f96 | ||
|
|
8b9e2c8526 | ||
|
|
0dc2d14736 | ||
|
|
fc5dada701 | ||
|
|
f34060c4e0 |
4
apps/desktop/package-lock.json
generated
4
apps/desktop/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@notesnook/desktop",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@notesnook/desktop",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@notesnook/desktop",
|
||||
"productName": "Notesnook",
|
||||
"description": "Your private note taking space",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"appAppleId": "1544027013",
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -70,10 +70,11 @@ export const PricingItem = ({
|
||||
<Paragraph size={SIZE.sm}>
|
||||
<Heading size={SIZE.lg - 2}>
|
||||
{Platform.OS === "android"
|
||||
? (product.data as RNIap.SubscriptionAndroid)
|
||||
? (product.data as RNIap.SubscriptionAndroid | undefined)
|
||||
?.subscriptionOfferDetails[0].pricingPhases
|
||||
.pricingPhaseList?.[0].formattedPrice
|
||||
: (product.data as RNIap.SubscriptionIOS)?.localizedPrice}
|
||||
.pricingPhaseList?.[0]?.formattedPrice
|
||||
: (product.data as RNIap.SubscriptionIOS | undefined)
|
||||
?.localizedPrice}
|
||||
</Heading>
|
||||
{product?.type === "yearly" || product?.offerType === "yearly"
|
||||
? "/year"
|
||||
|
||||
@@ -245,12 +245,12 @@ export const PricingPlans = ({
|
||||
size={SIZE.lg}
|
||||
>
|
||||
{(Platform.OS === "android"
|
||||
? (monthlyPlan?.product as RNIap.SubscriptionAndroid)
|
||||
?.subscriptionOfferDetails[0].pricingPhases
|
||||
.pricingPhaseList?.[0].formattedPrice
|
||||
: (monthlyPlan?.product as RNIap.SubscriptionIOS)
|
||||
.localizedPrice) ||
|
||||
(PremiumService.getMontlySub() as any).localizedPrice}
|
||||
? (monthlyPlan?.product as RNIap.SubscriptionAndroid | undefined)
|
||||
?.subscriptionOfferDetails[0]?.pricingPhases
|
||||
.pricingPhaseList?.[0]?.formattedPrice
|
||||
: (monthlyPlan?.product as RNIap.SubscriptionIOS | undefined)
|
||||
?.localizedPrice) ||
|
||||
(PremiumService.getMontlySub() as any)?.localizedPrice}
|
||||
/ mo
|
||||
</Paragraph>
|
||||
<Button
|
||||
@@ -314,8 +314,8 @@ export const PricingPlans = ({
|
||||
>
|
||||
{Platform.OS === "android"
|
||||
? (product.data as RNIap.SubscriptionAndroid)
|
||||
?.subscriptionOfferDetails[1].pricingPhases
|
||||
.pricingPhaseList?.[1].formattedPrice
|
||||
?.subscriptionOfferDetails[1]?.pricingPhases
|
||||
.pricingPhaseList?.[1]?.formattedPrice
|
||||
: (product.data as RNIap.SubscriptionIOS)?.localizedPrice}
|
||||
</Paragraph>{" "}
|
||||
for {product.cycleText}
|
||||
|
||||
@@ -91,7 +91,7 @@ export const Subscription = () => {
|
||||
function getPrice() {
|
||||
return Platform.OS === "android"
|
||||
? monthlyPlan?.product?.subscriptionOfferDetails[0].pricingPhases
|
||||
.pricingPhaseList?.[0].formattedPrice
|
||||
.pricingPhaseList?.[0]?.formattedPrice
|
||||
: monthlyPlan?.product?.localizedPrice;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
multiDexEnabled true
|
||||
versionCode 2069
|
||||
versionCode 2070
|
||||
versionName getNpmVersion()
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
||||
@@ -997,7 +997,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2060;
|
||||
CURRENT_PROJECT_VERSION = 2061;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
ENABLE_BITCODE = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1071,7 +1071,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.6.9;
|
||||
MARKETING_VERSION = 2.6.10;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@@ -1102,7 +1102,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 2060;
|
||||
CURRENT_PROJECT_VERSION = 2061;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1176,7 +1176,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.6.9;
|
||||
MARKETING_VERSION = 2.6.10;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
@@ -1335,7 +1335,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2060;
|
||||
CURRENT_PROJECT_VERSION = 2061;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1347,7 +1347,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.6.9;
|
||||
MARKETING_VERSION = 2.6.10;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
|
||||
@@ -1378,7 +1378,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 2060;
|
||||
CURRENT_PROJECT_VERSION = 2061;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
@@ -1391,7 +1391,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.6.9;
|
||||
MARKETING_VERSION = 2.6.10;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -1421,7 +1421,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2060;
|
||||
CURRENT_PROJECT_VERSION = 2061;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1495,7 +1495,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.6.9;
|
||||
MARKETING_VERSION = 2.6.10;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
||||
@@ -1526,7 +1526,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 2060;
|
||||
CURRENT_PROJECT_VERSION = 2061;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
@@ -1601,7 +1601,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.6.9;
|
||||
MARKETING_VERSION = 2.6.10;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"private": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"workspaces": [
|
||||
|
||||
4
apps/web/package-lock.json
generated
4
apps/web/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@notesnook/web",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@notesnook/web",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@aws-sdk/util-base64-browser": "^3.208.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@notesnook/web",
|
||||
"description": "Your private note taking space",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.10",
|
||||
"private": true,
|
||||
"main": "./src/app.js",
|
||||
"homepage": "https://notesnook.com/",
|
||||
|
||||
@@ -430,13 +430,15 @@ export function Editor(props: EditorProps) {
|
||||
onContentChange={onContentChange}
|
||||
onChange={onEditorChange}
|
||||
onDownloadAttachment={(attachment) => saveAttachment(attachment.hash)}
|
||||
onPreviewAttachment={async ({ hash, dataurl }) => {
|
||||
onPreviewAttachment={async (data) => {
|
||||
const { hash } = data;
|
||||
const attachment = db.attachments?.attachment(hash);
|
||||
if (attachment && attachment.metadata.type.startsWith("image/")) {
|
||||
const container = document.getElementById("dialogContainer");
|
||||
if (!(container instanceof HTMLElement)) return;
|
||||
|
||||
dataurl = dataurl || (await downloadAttachment(hash, "base64"));
|
||||
const dataurl =
|
||||
data.bloburl || (await downloadAttachment(hash, "base64"));
|
||||
if (!dataurl)
|
||||
return showToast("error", "This image cannot be previewed.");
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ export type Attachment = {
|
||||
mime: string;
|
||||
size: number;
|
||||
dataurl?: string;
|
||||
bloburl?: string;
|
||||
};
|
||||
|
||||
type AddAttachmentOptions = {
|
||||
|
||||
@@ -226,8 +226,10 @@ type UploadAdditionalData = {
|
||||
|
||||
async function uploadFile(filename: string, requestOptions: RequestOptions) {
|
||||
const fileHandle = await streamablefs.readFile(filename);
|
||||
if (!fileHandle)
|
||||
throw new Error(`File stream not found. (File hash: ${filename})`);
|
||||
if (!fileHandle || !(await exists(filename)))
|
||||
throw new Error(
|
||||
`File is corrupt or missing data. Please upload the file again. (File hash: ${filename})`
|
||||
);
|
||||
try {
|
||||
if (fileHandle.file.additionalData?.uploaded) {
|
||||
await checkUpload(filename);
|
||||
|
||||
14
bugs.md
14
bugs.md
@@ -1,14 +0,0 @@
|
||||
Mobile:
|
||||
|
||||
1. Select all notes in a topic -> Click on add button
|
||||
2. Edit button in a notebook doesn't work
|
||||
3. Edit notebook sheet doesn't close after saving edits
|
||||
4. Removing notes from a topic doesn't update the notes count in the list automatically
|
||||
5. Notes inside a notebook/topic keep showing the notebook tag at the top
|
||||
6.
|
||||
|
||||
Web:
|
||||
|
||||
1. When a note is in a single topic, its impossible to move it to its parent notebook
|
||||
2. When a note is in a single notebook, its impossible to remove it
|
||||
3. Disable sync -> Refresh app -> Enable sync & notice how the sync status is not updated nor does the sync run automatically
|
||||
@@ -1,81 +0,0 @@
|
||||
workflows:
|
||||
react-native-ios:
|
||||
name: Notesnook iOS Build
|
||||
max_build_duration: 120
|
||||
instance_type: mac_mini
|
||||
environment:
|
||||
groups:
|
||||
- appstore_credentials
|
||||
- certificate_credentials
|
||||
- provisioning_profile
|
||||
|
||||
vars:
|
||||
XCODE_WORKSPACE: "Notesnook.xcworkspace" # <-- Put the name of your Xcode workspace here
|
||||
XCODE_SCHEME: "Notesnook" # <-- Put the name of your Xcode scheme here
|
||||
BUNDLE_ID: "org.streetwriters.notesnook" # <-- Put your Bundle Id here e.g com.domain.myapp
|
||||
APP_STORE_APP_ID: 1544027013 # <-- Put the app id number here. This is found in App Store Connect > App > General > App Information
|
||||
|
||||
node: 16.13.2
|
||||
xcode: latest
|
||||
cocoapods: default
|
||||
cache:
|
||||
cache_paths:
|
||||
- $HOME/Library/Caches/CocoaPods
|
||||
scripts:
|
||||
- name: Install npm dependencies
|
||||
script: |
|
||||
npm i
|
||||
- name: Install CocoaPods dependencies
|
||||
script: |
|
||||
yarn prepare:ios
|
||||
- name: Set up keychain to be used for codesigning using Codemagic CLI 'keychain' command
|
||||
script: |
|
||||
keychain initialize
|
||||
- name: Set up Provisioning profiles from environment variables
|
||||
script: |
|
||||
PROFILES_HOME="$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||
mkdir -p "$PROFILES_HOME"
|
||||
for profile in "${!FCI_PROVISIONING_PROFILE_@}"; do
|
||||
PROFILE_PATH="$(mktemp "$HOME/Library/MobileDevice/Provisioning Profiles"/ios_$(uuidgen).mobileprovision)"
|
||||
echo ${!profile} | base64 --decode > "$PROFILE_PATH"
|
||||
echo "Saved provisioning profile $PROFILE_PATH"
|
||||
done
|
||||
- name: Set up signing certificate
|
||||
script: |
|
||||
echo $FCI_CERTIFICATE | base64 --decode > /tmp/certificate.p12
|
||||
if [ -z ${FCI_CERTIFICATE_PASSWORD+x} ]; then
|
||||
# when using a certificate that is not password-protected
|
||||
keychain add-certificates --certificate /tmp/certificate.p12
|
||||
else
|
||||
# when using a password-protected certificate
|
||||
keychain add-certificates --certificate /tmp/certificate.p12 --certificate-password $FCI_CERTIFICATE_PASSWORD
|
||||
fi
|
||||
- name: Set up code signing settings on Xcode project
|
||||
script: xcode-project use-profiles
|
||||
- name: Build packages
|
||||
script: |
|
||||
yarn build
|
||||
- name: Build ipa for distribution
|
||||
script: |
|
||||
xcode-project build-ipa --workspace "$FCI_BUILD_DIR/apps/mobile/native/ios/$XCODE_WORKSPACE" --scheme "$XCODE_SCHEME"
|
||||
artifacts:
|
||||
- build/ios/ipa/*.ipa
|
||||
- /tmp/xcodebuild_logs/*.log
|
||||
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.app
|
||||
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
|
||||
publishing:
|
||||
# See the following link for details about email publishing - https://docs.codemagic.io/publishing-yaml/distribution/#email
|
||||
email:
|
||||
recipients:
|
||||
- ammarahmed6506@gmail.com
|
||||
notify:
|
||||
success: true # To not receive a notification when a build succeeds
|
||||
failure: false # To not receive a notification when a build fails
|
||||
app_store_connect:
|
||||
api_key: $APP_STORE_CONNECT_PRIVATE_KEY # Contents of the API key, can also reference environment variable such as $APP_STORE_CONNECT_PRIVATE_KEY
|
||||
key_id: $APP_STORE_CONNECT_KEY_IDENTIFIER # Alphanumeric value that identifies the API key, can also reference environment variable such as $APP_STORE_CONNECT_KEY_IDENTIFIER
|
||||
issuer_id: $APP_STORE_CONNECT_ISSUER_ID # Alphanumeric value that identifies who created the API key, can also reference environment variable such as $APP_STORE_CONNECT_ISSUER_ID
|
||||
submit_to_testflight: false # Optional boolean, defaults to false. Whether or not to submit the uploaded build to TestFlight beta review. Required for distributing to beta groups. Note: This action is performed during post-processing.
|
||||
# beta_groups: # Specify the names of beta tester groups that will get access to the build once it has passed beta review.
|
||||
# - group name 1
|
||||
# - group name 2
|
||||
7
fastlane/metadata/android/en-US/changelogs/10354.txt
Normal file
7
fastlane/metadata/android/en-US/changelogs/10354.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
- Fixed HTML & PDF exports
|
||||
- Improved task lists in editor
|
||||
- Improved loading images
|
||||
- Allow restoring backups when logged out
|
||||
- Bug fixes and performance improvements
|
||||
|
||||
Thank you for using Notesnook!
|
||||
@@ -57,7 +57,8 @@ export function ImageComponent(
|
||||
height,
|
||||
textDirection,
|
||||
hash,
|
||||
aspectRatio
|
||||
aspectRatio,
|
||||
mime
|
||||
} = node.attrs;
|
||||
const float = isMobile ? false : node.attrs.float;
|
||||
|
||||
@@ -67,6 +68,7 @@ export function ImageComponent(
|
||||
const imageRef = useRef<HTMLImageElement>(null);
|
||||
const downloadOptions = useToolbarStore((store) => store.downloadOptions);
|
||||
const isReadonly = !editor.current?.isEditable;
|
||||
const isSVG = mime.includes("/svg");
|
||||
const relativeHeight = aspectRatio
|
||||
? editor.view.dom.clientWidth / aspectRatio
|
||||
: undefined;
|
||||
@@ -87,6 +89,7 @@ export function ImageComponent(
|
||||
? "start"
|
||||
: "end",
|
||||
position: "relative",
|
||||
mt: isSVG ? `24px` : 0,
|
||||
":hover .drag-handle, :active .drag-handle": {
|
||||
opacity: 1
|
||||
}
|
||||
@@ -139,7 +142,8 @@ export function ImageComponent(
|
||||
top: -40,
|
||||
right: 0,
|
||||
mb: 2,
|
||||
alignItems: "end"
|
||||
alignItems: "end",
|
||||
zIndex: 999
|
||||
}}
|
||||
>
|
||||
<ToolbarGroup
|
||||
@@ -184,7 +188,31 @@ export function ImageComponent(
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isSVG ? (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
display: editor.isEditable ? "flex" : "none",
|
||||
position: "absolute",
|
||||
top: -24,
|
||||
height: 24,
|
||||
justifyContent: "end",
|
||||
p: "small",
|
||||
bg: editor.isEditable
|
||||
? "var(--background-secondary)"
|
||||
: "transparent",
|
||||
borderTopLeftRadius: "default",
|
||||
borderTopRightRadius: "default",
|
||||
borderColor: selected ? "border" : "var(--border-secondary)",
|
||||
cursor: "pointer",
|
||||
":hover": {
|
||||
borderColor: "border"
|
||||
}
|
||||
}}
|
||||
></Box>
|
||||
) : null}
|
||||
<AnimatedImage
|
||||
as={isSVG ? "object" : "img"}
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: bloburl || src ? 1 : 0 }}
|
||||
transition={{ duration: 0.5, ease: "easeIn" }}
|
||||
@@ -192,11 +220,20 @@ export function ImageComponent(
|
||||
ref={imageRef}
|
||||
alt={alt}
|
||||
crossOrigin="anonymous"
|
||||
src={
|
||||
toBlobURL("", hash) ||
|
||||
bloburl ||
|
||||
corsify(src, downloadOptions?.corsHost)
|
||||
}
|
||||
{...(isSVG
|
||||
? {
|
||||
data:
|
||||
toBlobURL("", hash) ||
|
||||
bloburl ||
|
||||
corsify(src, downloadOptions?.corsHost),
|
||||
type: mime
|
||||
}
|
||||
: {
|
||||
src:
|
||||
toBlobURL("", hash) ||
|
||||
bloburl ||
|
||||
corsify(src, downloadOptions?.corsHost)
|
||||
})}
|
||||
title={title}
|
||||
sx={{
|
||||
objectFit: "contain",
|
||||
|
||||
@@ -111,12 +111,14 @@ export function TaskListComponent(
|
||||
if (!node) return false;
|
||||
const toggleState = !node.attrs.readonly;
|
||||
tr.setNodeMarkup(tr.mapping.map(parentPos), null, {
|
||||
...node.attrs,
|
||||
readonly: toggleState
|
||||
});
|
||||
node.descendants((node, pos) => {
|
||||
if (node.type.name === TaskList.name) {
|
||||
const actualPos = pos + parentPos + 1;
|
||||
tr.setNodeMarkup(tr.mapping.map(actualPos), null, {
|
||||
...node.attrs,
|
||||
readonly: toggleState
|
||||
});
|
||||
}
|
||||
|
||||
@@ -238,6 +238,7 @@ export const TaskListNode = TaskList.extend({
|
||||
tr.doc.descendants((node, pos) => {
|
||||
if (node.type.name === TaskList.name) {
|
||||
tr.setNodeMarkup(pos, undefined, {
|
||||
...node.attrs,
|
||||
stats: countCheckedItems(node)
|
||||
});
|
||||
return false;
|
||||
@@ -246,7 +247,7 @@ export const TaskListNode = TaskList.extend({
|
||||
view.dispatch(tr);
|
||||
return {};
|
||||
},
|
||||
appendTransaction(transactions, _oldState, newState) {
|
||||
appendTransaction(transactions, oldState, newState) {
|
||||
if (!transactions[0].docChanged) return;
|
||||
|
||||
const changedNodes = getExactChangedNodes(
|
||||
@@ -270,7 +271,9 @@ export const TaskListNode = TaskList.extend({
|
||||
if (
|
||||
// when a task item has children, the task list is always the
|
||||
// last child
|
||||
edit.node.lastChild?.type.name === TaskList.name
|
||||
edit.node.lastChild?.type.name === TaskList.name &&
|
||||
oldState.doc.nodeAt(edit.pos)?.attrs.checked !==
|
||||
newState.doc.nodeAt(edit.pos)?.attrs.checked
|
||||
) {
|
||||
changeCount += toggleChildren(
|
||||
tr,
|
||||
@@ -304,6 +307,7 @@ export const TaskListNode = TaskList.extend({
|
||||
|
||||
changeCount++;
|
||||
tr.setNodeMarkup(tr.mapping.map(parentTaskItem.pos), undefined, {
|
||||
...parentTaskItem.node.attrs,
|
||||
checked: allChecked
|
||||
});
|
||||
childPos = parentTaskItem.pos;
|
||||
@@ -318,7 +322,10 @@ export const TaskListNode = TaskList.extend({
|
||||
roots.add(root);
|
||||
|
||||
const stats = countCheckedItems(root.node);
|
||||
tr.setNodeMarkup(root.pos, undefined, { stats });
|
||||
tr.setNodeMarkup(root.pos, undefined, {
|
||||
...root.node.attrs,
|
||||
stats
|
||||
});
|
||||
changeCount++;
|
||||
}
|
||||
}
|
||||
@@ -388,6 +395,7 @@ function toggleChildren(
|
||||
) {
|
||||
const actualPos = pos + parentPos + 1;
|
||||
tr.setNodeMarkup(tr.mapping.map(actualPos), undefined, {
|
||||
...node.attrs,
|
||||
checked: toggleState
|
||||
});
|
||||
changes++;
|
||||
|
||||
@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import DataURL from "@notesnook/core/dist/utils/dataurl";
|
||||
|
||||
export type DownloadOptions = {
|
||||
corsHost: string;
|
||||
};
|
||||
@@ -119,8 +121,10 @@ export function toBlobURL(dataurl: string, id?: string) {
|
||||
if (id && OBJECT_URL_CACHE[id]) return OBJECT_URL_CACHE[id];
|
||||
if (!isDataUrl(dataurl)) return;
|
||||
|
||||
const { data, mime } = DataURL.toObject(dataurl); //.split(",");
|
||||
if (!data || !mime) return;
|
||||
const objectURL = URL.createObjectURL(
|
||||
new Blob([Buffer.from(dataurl.split(",")[1], "base64")])
|
||||
new Blob([Buffer.from(data, "base64")], { type: mime })
|
||||
);
|
||||
|
||||
if (id) OBJECT_URL_CACHE[id] = objectURL;
|
||||
|
||||
Reference in New Issue
Block a user