كما ذُكر أعلاه، سيعمل هذا المكون فقط على أجهزة سطح المكتب. لا توجد فائدة كبيرة من عرض المعاينات على الأجهزة المحمولة لأن كل شيء سيكون صغيرًا جدًا وصعب القراءة.
يستخدم هذا المكون التنفيذ الأصلي للمتصفح لعرض ملفات PDF، لذا قد تختلف النتائج في المظهر باختلاف المتصفحات.
أيضًا، يرجى ملاحظة أن رفع ملفات PDF غير مسموح به افتراضيًا في Discourse. إذا كنت تريد السماح لمستخدميك برفع ملفات PDF، فستحتاج إلى إضافة هذا الامتداد إما إلى authorized_extensions إذا كنت تريد أن يتمكن جميع المستخدمين من رفع ملفات PDF، أو authorized_extensions_for_staff إذا كنت تريد تقييد ذلك على أعضاء الطاقم فقط.
Access to fetch at 'https://travelmassive-discourse-cdn.s3.dualstack.us-west-1.amazonaws.com/original/2X/b/b578f6364592121964e6a2fd4969e5c1222bd909.pdf' (redirected from 'https://lounge.travelmassive.com/uploads/short-url/pTnA3r043WfhDK8HSdPQrtNn8Lf.pdf') from origin 'https://lounge.travelmassive.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Update
I was able to fix this by adding the following CORS policy in my S3 bucket configuration.
It’s necessary to add, that if you see this text in the error message from origin 'https://lounge.travelmassive.com' has been where your domain is without slash / at the end, then in the CORS configuration you should also add your domain without slash at the end like this: https://mydiscourse.url
I noticed that your uploads are on AWS so, the issue is probably CORS related (the component is not active on your site for me to confirm). See the post below yours.
thanks for sharing that!
Please note that this issue will only affect self-hosters that have set up something like S3. Self-hosters that are not using S3 will not run into this issue. Customers hosted by CDCK will also not need to worry about that since they already have that set up.
That said, CORS configuration is a bit outside of the scope of this topic. If your uploads bucket does not allow your own domain access, then that needs to be fixed regardless since there might be some other issues caused by that.
I’m a little bit unsure what happened here. Both cases seem to be working for me everytime I try. We can just chalk it up to a transitory network issue but please let me know if you see it again
I pushed a tiny update to this component that should improve the loading perception, there’s now a theme-color based placeholder instead of the default browser Iframe styles. It only shows up while the file is loading so 99% of the time, you won’t even notice it.
هل من الممكن جعل معاينة PDF قابلة للإخفاء بإضافة مسافة قبل رابط الرفع، مثلما يحدث مع التضمين البسيط؟ في بعض الأحيان تريد قائمة بالوثائق وليس المعاينات، وفي أحيان أخرى تريد معاينة.
أنا أستخدم متصفح سفاري على نظام ماك أو إس كاتالينا، ولا أملك أي إعدادات تمنع عرض ملفات PDF داخل المتصفح — على سبيل المثال، الرابط http://www.orimi.com/pdf-test.pdf يعمل بشكل صحيح. لكنني لا أزال أواجه نافذة/رسالة “الإضافة المحظورة” عند معاينة التصميم في منشئ السمات.
إعدادات الموقع المحددة في تفضيلات سفاري لا تختلف عن المواقع الأخرى.
لا يزال الأمر لا يعمل بالنسبة لي على Safari في نظام MacOS Big Sur. لا توجد إعدادات خاصة لإضافات المدونة، وتُعرض ملفات PDF أخرى في المتصفح.
يُظهر Safari Web Inspector الشكاوى التالية عند تحميل صفحة المعاينة في theme-creator: توجيه غير معترف به في سياسة أمان المحتوى 'worker-src'. تم رفض تحميل blob:https://theme-creator.discourse.org/7b9b62c7-e782-4080-a521-04e3b06aa142 لأنه غير موجود في توجيه object-src لسياسة أمان المحتوى.
لذا أنا في حيرة - خاصةً حول سبب عمله في منتديين أديرهما ولا يعمل في الآخر - مع أن S3 هو الاختلاف الوحيد. وأنك نجحت في جعله يعمل مع S3. أنا حقًا في حيرة من أمري.
قد يكون هناك تعارض مع مكون أو سمة أخرى. إنه يعمل كما هو متوقع بالنسبة لي. ابدأ بتعطيل المكونات الأخرى وجرب استخدام السمة الافتراضية إذا كانت سمتك مختلفة. الأمر نفسه ينطبق على الإضافات.