mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-04-16 11:17:20 +02:00
add share menu
This commit is contained in:
parent
e8464cf7b6
commit
debf45e4d6
7
dist/styles.css
vendored
7
dist/styles.css
vendored
@ -55,6 +55,7 @@ html, body {
|
|||||||
.ms-ContextualMenu-link, .ms-Button {
|
.ms-ContextualMenu-link, .ms-Button {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
.ms-Nav-link, .ms-Nav-chevronButton {
|
.ms-Nav-link, .ms-Nav-chevronButton {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@ -234,6 +235,12 @@ nav.item-on .btn-group .btn.system {
|
|||||||
body.darwin .btn-group .btn.system {
|
body.darwin .btn-group .btn.system {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.qr-container {
|
||||||
|
height: 150px;
|
||||||
|
padding: 7px;
|
||||||
|
margin: 8px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.menu-container, .article-container {
|
.menu-container, .article-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -85,9 +85,6 @@
|
|||||||
"@types/react": "^16.9.35",
|
"@types/react": "^16.9.35",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/react-dom": "^16.9.8",
|
||||||
"@types/react-redux": "^7.1.9",
|
"@types/react-redux": "^7.1.9",
|
||||||
"@types/redux": "^3.6.0",
|
|
||||||
"@types/redux-thunk": "^2.1.0",
|
|
||||||
"@types/reselect": "^2.2.0",
|
|
||||||
"@yang991178/rss-parser": "^3.8.1",
|
"@yang991178/rss-parser": "^3.8.1",
|
||||||
"electron": "^9.0.5",
|
"electron": "^9.0.5",
|
||||||
"electron-builder": "^22.7.0",
|
"electron-builder": "^22.7.0",
|
||||||
@ -96,6 +93,7 @@
|
|||||||
"electron-window-state": "^5.0.3",
|
"electron-window-state": "^5.0.3",
|
||||||
"html-webpack-plugin": "^4.3.0",
|
"html-webpack-plugin": "^4.3.0",
|
||||||
"nedb": "^1.8.0",
|
"nedb": "^1.8.0",
|
||||||
|
"qrcode.react": "^1.0.0",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-intl-universal": "^2.2.5",
|
"react-intl-universal": "^2.2.5",
|
||||||
|
@ -2,8 +2,9 @@ import * as React from "react"
|
|||||||
import intl from "react-intl-universal"
|
import intl from "react-intl-universal"
|
||||||
import { renderToString } from "react-dom/server"
|
import { renderToString } from "react-dom/server"
|
||||||
import { RSSItem } from "../scripts/models/item"
|
import { RSSItem } from "../scripts/models/item"
|
||||||
import { Stack, CommandBarButton, IContextualMenuProps, FocusZone } from "@fluentui/react"
|
import { Stack, CommandBarButton, IContextualMenuProps, FocusZone, ContextualMenuItemType } from "@fluentui/react"
|
||||||
import { RSSSource, SourceOpenTarget } from "../scripts/models/source"
|
import { RSSSource, SourceOpenTarget } from "../scripts/models/source"
|
||||||
|
import { shareSubmenu } from "./context-menu"
|
||||||
|
|
||||||
const FONT_SIZE_OPTIONS = [12, 13, 14, 15, 16, 17, 18, 19, 20]
|
const FONT_SIZE_OPTIONS = [12, 13, 14, 15, 16, 17, 18, 19, 20]
|
||||||
|
|
||||||
@ -75,7 +76,12 @@ class Article extends React.Component<ArticleProps, ArticleState> {
|
|||||||
text: this.props.item.hidden ? intl.get("article.unhide") : intl.get("article.hide"),
|
text: this.props.item.hidden ? intl.get("article.unhide") : intl.get("article.hide"),
|
||||||
iconProps: { iconName: this.props.item.hidden ? "View" : "Hide3" },
|
iconProps: { iconName: this.props.item.hidden ? "View" : "Hide3" },
|
||||||
onClick: () => { this.props.toggleHidden(this.props.item) }
|
onClick: () => { this.props.toggleHidden(this.props.item) }
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
key: "divider_1",
|
||||||
|
itemType: ContextualMenuItemType.Divider,
|
||||||
|
},
|
||||||
|
...shareSubmenu(this.props.item)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import intl from "react-intl-universal"
|
import intl from "react-intl-universal"
|
||||||
|
import QRCode from "qrcode.react"
|
||||||
import { cutText, googleSearch } from "../scripts/utils"
|
import { cutText, googleSearch } from "../scripts/utils"
|
||||||
import { ContextualMenu, IContextualMenuItem, ContextualMenuItemType, DirectionalHint } from "office-ui-fabric-react/lib/ContextualMenu"
|
import { ContextualMenu, IContextualMenuItem, ContextualMenuItemType, DirectionalHint } from "office-ui-fabric-react/lib/ContextualMenu"
|
||||||
import { ContextMenuType } from "../scripts/models/app"
|
import { ContextMenuType } from "../scripts/models/app"
|
||||||
@ -31,6 +32,19 @@ export type ContextMenuProps = ContextReduxProps & {
|
|||||||
close: () => void
|
close: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const shareSubmenu = (item: RSSItem): IContextualMenuItem[] => [
|
||||||
|
{ key: "qr", url: item.link, onRender: renderShareQR }
|
||||||
|
]
|
||||||
|
|
||||||
|
const renderShareQR = (item: IContextualMenuItem) => (
|
||||||
|
<div className="qr-container">
|
||||||
|
<QRCode
|
||||||
|
value={item.url}
|
||||||
|
size={150}
|
||||||
|
renderAs="svg" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
export class ContextMenu extends React.Component<ContextMenuProps> {
|
export class ContextMenu extends React.Component<ContextMenuProps> {
|
||||||
getItems = (): IContextualMenuItem[] => {
|
getItems = (): IContextualMenuItem[] => {
|
||||||
switch (this.props.type) {
|
switch (this.props.type) {
|
||||||
@ -75,12 +89,21 @@ export class ContextMenu extends React.Component<ContextMenuProps> {
|
|||||||
{
|
{
|
||||||
key: "toggleHidden",
|
key: "toggleHidden",
|
||||||
text: this.props.item.hidden ? intl.get("article.unhide") : intl.get("article.hide"),
|
text: this.props.item.hidden ? intl.get("article.unhide") : intl.get("article.hide"),
|
||||||
|
iconProps: { iconName: this.props.item.hidden ? "View" : "Hide3" },
|
||||||
onClick: () => { this.props.toggleHidden(this.props.item) }
|
onClick: () => { this.props.toggleHidden(this.props.item) }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "divider_1",
|
key: "divider_1",
|
||||||
itemType: ContextualMenuItemType.Divider,
|
itemType: ContextualMenuItemType.Divider,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "share",
|
||||||
|
text: intl.get("context.share"),
|
||||||
|
iconProps: { iconName: "Share" },
|
||||||
|
subMenuProps: {
|
||||||
|
items: shareSubmenu(this.props.item)
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "copyTitle",
|
key: "copyTitle",
|
||||||
text: intl.get("context.copyTitle"),
|
text: intl.get("context.copyTitle"),
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
"loadWebpage": "Load webpage"
|
"loadWebpage": "Load webpage"
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
|
"share": "Share",
|
||||||
"read": "Read",
|
"read": "Read",
|
||||||
"copyTitle": "Copy title",
|
"copyTitle": "Copy title",
|
||||||
"copyURL": "Copy link",
|
"copyURL": "Copy link",
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
"loadWebpage": "Cargar página web"
|
"loadWebpage": "Cargar página web"
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
|
"share": "Compartir",
|
||||||
"read": "Leer",
|
"read": "Leer",
|
||||||
"copyTitle": "Copiar título",
|
"copyTitle": "Copiar título",
|
||||||
"copyURL": "Copiar enlace",
|
"copyURL": "Copiar enlace",
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
"loadWebpage": "Charger la page web"
|
"loadWebpage": "Charger la page web"
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
|
"share": "Partager",
|
||||||
"read": "Lu",
|
"read": "Lu",
|
||||||
"copyTitle": "Copier le titre",
|
"copyTitle": "Copier le titre",
|
||||||
"copyURL": "Copier le lien",
|
"copyURL": "Copier le lien",
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
"loadWebpage": "加载网页"
|
"loadWebpage": "加载网页"
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
|
"share": "分享",
|
||||||
"read": "阅读",
|
"read": "阅读",
|
||||||
"copyTitle": "复制标题",
|
"copyTitle": "复制标题",
|
||||||
"copyURL": "复制链接",
|
"copyURL": "复制链接",
|
||||||
|
@ -244,10 +244,10 @@ export function addSource(url: string, name: string = null, batch = false): AppT
|
|||||||
.then(inserted => {
|
.then(inserted => {
|
||||||
inserted.unreadCount = feed.items.length
|
inserted.unreadCount = feed.items.length
|
||||||
dispatch(addSourceSuccess(inserted, batch))
|
dispatch(addSourceSuccess(inserted, batch))
|
||||||
|
window.settings.saveGroups(getState().groups)
|
||||||
return RSSSource.checkItems(inserted, feed.items)
|
return RSSSource.checkItems(inserted, feed.items)
|
||||||
.then(items => insertItems(items))
|
.then(items => insertItems(items))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
window.settings.saveGroups(getState().groups)
|
|
||||||
return inserted.sid
|
return inserted.sid
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user